Iphone 如何从UITableviewController中的操作弹出子视图
我想从tableview控制器上的按钮位置执行的操作之一弹出一个子视图弹出窗口 我最初添加了一个子ViewInitialy隐藏在屏幕下方,后来想将其设置为动画 动画和弹出窗口。 这是按钮操作的代码Iphone 如何从UITableviewController中的操作弹出子视图,iphone,objective-c,Iphone,Objective C,我想从tableview控制器上的按钮位置执行的操作之一弹出一个子视图弹出窗口 我最初添加了一个子ViewInitialy隐藏在屏幕下方,后来想将其设置为动画 动画和弹出窗口。 这是按钮操作的代码 -(IBAction) finalShareVerse: (id) sender { NSLog(@"finalShare Button"); UIView *tempView; CGRect tmpFrame; tempView = [[[UIView alloc]
-(IBAction) finalShareVerse: (id) sender
{
NSLog(@"finalShare Button");
UIView *tempView;
CGRect tmpFrame;
tempView = [[[UIView alloc] initWithFrame:CGRectMake(0, 490, 320, 90)]
autorelease];
[tempView setBackgroundColor:[UIColor blackColor]];
[tempView setAlpha:.87];
[self.view addSubview:tempView];
tmpFrame = tempView.frame;
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:.75];
tmpFrame.origin.y=390;
self.view.frame=tmpFrame;
[UIView commitAnimations];
}
问题是,现在父控制器设置动画并弹出,而不是
要弹出的子视图。
是否有方法指定仅在子视图上触发的动画
我是iPhone应用程序开发新手。。请告知。如果我理解正确,问题在于线路:
self.view.frame=tmpFrame;
您正在将位置更改应用于视图,而不是tmpViewThanx,用于此。。。问题是tempView是函数的局部变量。。一旦我把它作为一个实例变量,它就工作得很好。。。再来一次。