UITableViewCell調整寬度(轉)


http://blog.seymourdev.com/?p=712

UITableViewCell調整寬度

首先先說一下, 這個渣渣是不管用的:

1
- ( CGRect )rectForRowAtIndexPath :( NSIndexPath * )indexPath ;

這個需要自己寫一個UITableViewCell的子類然后把setFrame給override掉. 就像這樣:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
@interface LeftMarginTableViewCell : UITableViewCell
 
@end
 
@implementation LeftMarginTableViewCell
 
- ( void )setFrame :( CGRect )frame
{
     frame .origin.x += 120 ;
     frame .size.width -= 120 ;
     [ super setFrame : frame ];
}
 
@end

搞定. 然后, 然后就木有然后了.

好吧, 蘋果的框架對於開發者大多時候都是灰常灰常人性化的. 但是需要做某些特殊的東西的時候, 我真心覺得這個比讓網站兼容IE還煩人.

 

http://blog.sina.com.cn/s/blog_9ca91e4a0100xlve.html

UITableViewCell編輯修改整體frame

(2012-02-20 10:55:53)
標簽:

雜談

分類: iPhone
在自定義CELL中加入此方法:
 
- (void)layoutSubviews

{

    [super layoutSubviews];

    

    if ([super isEditing]) {

        //編輯時的需要的frame

    }else {

        //取消編輯時的需要的frame

    }

}


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM