0
我已经阅读了如何在xcode4.2上移动一个对象,并且我成功移动了一个按钮。但我无法移动桌面视图。在xcode 4.2上移动tableview
这里是Viewcontroller.m代码:
- (IBAction) unhide {
if (flag==1) {
flag=0;
CGRect frame = testtable.frame;
frame.origin.x = frame.origin.x; // new x coordinate
frame.origin.y = 150; // new y coordinate
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration: 0.25];
testtable.frame = frame;
[UIView commitAnimations];
}
else{
flag=1;
CGRect frame = testtable.frame;
frame.origin.x = frame.origin.x; // new x coordinate
frame.origin.y = 350; // new y coordinate
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration: 0.25];
testtable.frame = frame;
[UIView commitAnimations];
}}
预先感谢您。
测试表可能是'nil'。附:这种动画风格非常古老,你应该使用基于iOS 4 – borrrden 2013-03-01 05:04:58
的新模块,这个模块不工作?你的unhide方法被称为?测试表实际上是否为零? – Shaun 2013-03-01 05:07:05
@borrrden我该如何解决它?对不起,我的愚蠢问题,我对目标c完全新手。如果你给我关于“基于块的”教程,我很高兴。先谢谢你。 – jackiviet 2013-03-01 05:37:12