在我的应用程序中,我想在超过 3 个视图中使用 pagecontrol 的实例..所以,我想声明,@property 和 @synthesize 应该在 appDelegate 中..请给出一些想法来做到这一点......
谢谢,马诺
在我的应用程序中,我想在超过 3 个视图中使用 pagecontrol 的实例..所以,我想声明,@property 和 @synthesize 应该在 appDelegate 中..请给出一些想法来做到这一点......
谢谢,马诺
我从未使用过 pagecontrol,但原则上,您的代码如下所示:
在 YourAppDelegate .h
@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