在我的应用程序中,我想在3个以上的视图中使用pagecontrol的实例..所以,我想声明,@ property和@synthesize应该在appDelegate中..请给出一些想法来做到这一点......
谢谢, 真
答案 0 :(得分:0)
我从未使用过pagecontrol,但原则上,你的代码看起来像是:
@interface YourAppDelegate : NSObject <UIApplicationDelegate> {
...
UIPageControl *pageControl;
...
}
@property (nonatomic, retain) IBOutlet ScrollingViewController *viewController;
YourAppDelegate.m:
- (void)applicationDidFinishLaunching:(UIApplication *)application {
pageControl = [[UIPageControl alloc] init]; // or whatever is needed to set up pagecontrol
}
在你的一个观点中:
YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
//and then access the variable by appDelegate.variable