我想要一個按鈕來切換點擊時元素的位置。iOS/Xcode - 切換按鈕位置
我當前的代碼:
-(IBAction)menuTouched{
// Push menu
UITableView * sideMenu = [[UITableView alloc] initWithFrame:CGRectMake(1060, 88, 63, 661)];
sideMenu.backgroundColor = [UIColor redColor];
[self.view addSubview:sideMenu];
// Animate
[UIView animateWithDuration:1.25 animations:^{
sideMenu.frame = CGRectMake(960, 88, 63, 661);
}];
}
當點擊它的動畫中的tableview就像我想的按鈕。但是現在我想通過按下完全相同的按鈕來動畫化tableview。所以簡而言之,我希望通過更改X位置來使按鈕切入和切出一個表格視圖。什麼是最好的/最簡單的方法?
在此先感謝。
@tolylon:檢查我的答案,它會幫助你。 – 2013-05-13 12:39:53