0

我想導航到另一個視圖。我喜歡現在播放我的廣播應用程序的按鈕。我希望視圖能夠改變它的狀態......我想要瀏覽的視圖有一個用於放射線的url的文本字段和一個用於收音機名稱的標籤。所以我該如何考慮這種觀點的狀態,因爲現在,當我嘗試導航時,它可以很好地導航,但文本字段發生變化..所以我可以做些什麼來不改變文本? 這裏是一些代碼抱歉奇怪的名字導航到另一個視圖iPhone SDK?

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

你好,請你可以把你在正確的格式代碼,所以我可以幫你。 – 2011-05-01 12:39:14

+0

是的,當然很抱歉 – 2011-05-03 00:49:05

+0

請看看代碼格式化的問題 – 2011-05-03 00:51:29

回答

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 
相關問題