我想导航到另一个视图。我喜欢我的收音机应用程序的现在播放按钮。我希望这个视图能够建立它的状态......我想要导航到的视图有一个文本字段,用于放射的url和一个无线电名称的标签。那么我如何能够了解该视图的状态,因为现在当我尝试导航它时导航很好但是文本字段发生了变化..所以我该怎么做才能不改变文本? 这里有一些代码对于奇怪的名字感到抱歉
if (self.bookDetailViewController_1 == nil)
{
iPhoneStreamingPlayerViewController *aBookDetail = [[iPhoneStreamingPlayerViewController alloc] initWithNibName:@"iPhoneStreamingPlayerView" bundle:nil];
self.bookDetailViewController_1= aBookDetail;
[aBookDetail release];
}
Music_appAppDelegate *delegate = [[UIApplication sharedApplication]delegate];
[delegate.booksNavController pushViewController:bookDetailViewController_1 animated:YES];
答案 0 :(得分:0)
单身实施
//.h
+ (className *)sharedInstance;
//.m
static className* sharedInstance = nil;
@implementation className
+ (className*)sharedInstance {
if (!sharedInstance) {
sharedInstance = [[super allocWithZone:NULL] init];
}
return sharedInstance;
}
+ (id)allocWithZone:(NSZone *)zone {
return [[self sharedInstance] retain];
}
- (id)copyWithZone:(NSZone *)zone {
return self;
}
- (id)retain {
return self;
}
- (NSUInteger)retainCount {
return NSUIntegerMax;
}
- (void)release { }
- (id)autorelease {
return self;
}
@end