所以我有我的應用程序,我有一個帶水龍頭計數器和顯示標籤的視圖。我希望它在主視圖(現在它)上顯示文本,但也在第二個視圖上顯示。從兩個視圖上的水龍頭計數器顯示文字
那麼我怎麼能在另一個視圖上顯示文本。如果需要更多的細節,請發郵件
重現步驟FOR TAP計數器 .h文件:
@interface Level1 : UIViewController {
int counter;
IBOutlet UILabel *count;
}
-(IBAction)plus;
@property (assign) int counter;
@end
.m文件:
@synthesize counter;
- (void) viewDidLoad {
counter=1;
count.text = @"0";
[super viewDidLoad];
}
-(IBAction)plus {
counter=counter + 1;
count.text = [NSString stringWithFormat:@"%i",counter];
}
@end
在此先感謝
我不太認同,你可以Skype我解釋一下。 –
Kyle Greenlaw .. –
請指出您確切無法理解的內容,以便我可以對此發表評論。基本上我提到的模型將會是你的新課堂。請閱讀模型視圖控制器[鏈接](https://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/CocoaDesignPatterns.html#//apple_ref/doc/uid/TP40002974-CH6 -SW1)瞭解這種方法。 –