【发布时间】:2011-01-03 06:50:57
【问题描述】:
在我的应用程序中,我想在超过 3 个视图中使用 pagecontrol 实例。所以,我想声明,@property 和 @synthesize 应该在 appDelegate 中。请给出一些想法来做到这一点...
谢谢, 马诺
【问题讨论】:
标签: iphone uipagecontrol
在我的应用程序中,我想在超过 3 个视图中使用 pagecontrol 实例。所以,我想声明,@property 和 @synthesize 应该在 appDelegate 中。请给出一些想法来做到这一点...
谢谢, 马诺
【问题讨论】:
标签: iphone uipagecontrol
我从未使用过 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
【讨论】: