如何实现代码在3秒后自动显示超级视图的子视图而不点击iPhone中的任何按钮?
答案 0 :(得分:3)
NSTimer *t = [NSTimer scheduledTimerWithTimeInterval: 3
target: self
selector:@selector(showSuperView)
userInfo: nil repeats:NO];
如果你想显示childview的超级视图那么
-(void)showSuperView
{
[childView superview].hidden = NO;
}
如果你想显示superview的childView那么
-(void)showchildView
{
for([UiView* v in superview.subviews])
{
//implement the condition to identify concerned childView
v.hidden = NO;
}
}
答案 1 :(得分: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];
}
希望这有用!:)