2012-02-20 71 views
-3

如何實現在3秒後自動顯示superview的子視圖的代碼,而無需點擊iPhone中的任何按鈕?如何顯示superview的子視圖?

+0

這是沒有意義的,而你的問題文本與你的頭銜相矛盾。請編輯更多信息的問題和/或標題 – jrturton 2012-02-20 11:01:14

回答

3
NSTimer *t = [NSTimer scheduledTimerWithTimeInterval: 3 
                 target: self 
                selector:@selector(showSuperView) 
                userInfo: nil repeats:NO]; 

如果你想顯示childview的那麼

-(void)showSuperView 
{ 
[childView superview].hidden = NO; 
} 

,如果你想顯示上海華的childView然後

-(void)showchildView 
    { 
    for([UiView* v in superview.subviews]) 
{ 
//implement the condition to identify concerned childView 
v.hidden = NO; 
} 
    } 
1
NSDate *current=[[[NSDate alloc] init] autorelease]; 
NSTimer *timer=[[NSTimer alloc] initWithFireDate:current interval:3.0 target:self selector:@selector(gotoNextView) userInfo:nil repeats:NO]autoreleas]; 

- (IBAction) gotoNextView 
{ 
    yourNextView *obj=[[[yourNextView alloc] initWithNibName:@"yourNextView" bundle:nil]autorelease]; 
    [self.navigationController pushViewController:obj animated:YES]; 
} 

希望這會有所幫助!:)

上海華