2011年4月24日 星期日

讀取info.plist

// AboutMeViewController.h
#import

@interface AboutMeViewController : UIViewController {
IBOutlet UILabel *appName;
IBOutlet UILabel *appVersion;
IBOutlet UILabel *appProducer;
}
@property (nonatomic, retain) IBOutlet UILabel *appName;
@property (nonatomic, retain) IBOutlet UILabel *appVersion;
@property (nonatomic, retain) IBOutlet UILabel *appProducer;
@end
// AboutMeViewController.m
#import "AboutMeViewController.h"
@implementation AboutMeViewController
@synthesize appName, appVersion, appProducer;
- (void)viewDidLoad {
NSString *tempName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
appName.text = tempName;
[tempName release];
NSString *tempVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
appVersion.text = tempVersion;
[tempVersion release];
NSString *tempAuthor = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"];
appProducer.text = tempAuthor;
[tempAuthor release];
[super viewDidLoad];
}

沒有留言:

張貼留言