循環在換在環有點像這樣:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.row == 0) {
for (UIView *view in self.view.subviews) //change this to your container {
if (view.tag == 14)
continue;
/*Do Nothing, this is the golden view that stays on screen. Maybe set it's frame or alpha, but don't hide it.
*/
else
[view setFrame:CGRectMake(0, self.view.bounds.size.height, 768, 1024)]; //set this to any value that puts the view offscreen or set alpha to 0
}
}
}
這一切都取決於你設置的標籤,索引選擇和查看要排除
雖然,這取決於你想要的變化,或者有多少。你必須改變的對象,th方法可能實際上可能更麻煩。
不,不一定。假設你想有多個視圖(不是最好的例子,但嘿!),那麼你會排除多個標籤。索引就在那裏,以確定哪些單元格被按下。「 – CodaFi 2012-02-20 00:20:22
你有任何建議閱讀設置子視圖嗎?對於objC來說還是很新鮮的。謝謝! – DrTchocky 2012-02-20 00:25:09
如果你確實有多個對象(我的意思是很多)需要動畫或者更改,那麼將它們全部包含在它們自己的UIView中,而不是減少代碼。另外[UIView animateWithDuration:動畫^ {}];是一種非常簡單的方式,可以讓您的應用看起來很專業,並擺脫那些生澀的框架變化。 – CodaFi 2012-02-20 00:27:06