2011-09-08 17 views

回答

3

簡單地定製您的UITableViewCellsee here)並添加自定義UILabel作爲細胞的一個子視圖,使其顯示在右側。

如果你想使這個的UILabel看起來像在郵件中的,這是很簡單的,因爲你可能會嘗試STHG這樣的:

countLabel = [[[UILabel alloc] initWithFrame:CGRectMake(140,10,60,24)] autorelease]; 
countLabel.textColor = [UIColor whiteColor]; 
countLabel.layer.backgroundColor = [UIColor grayColor].CGColor; 
countLabel.layer.cornerRadius = countLabel.bounds.size.height/2; 
countLabel.masksToBounds = YES; 
[cell.contentView addSubview:countLabel]; 

countLabel.text = [categoryItems count]; 

(注:使用的UILabel的圖層屬性,別忘了添加QuartzCore框架和#import <QuartzCore/QuartzCore.h>

+0

非常感謝AliSoftware !!!我節省了很多時間,因爲我認爲這是一種輔助類型... – iosDeveloper

3

檢查出TDBadgeCell庫Github上。

enter image description here

+0

這也不錯!由於我的要求非常簡單,我只是使用@AliSoftware顯示的簡單代碼創建的。不管怎麼說,還是要謝謝你!!! – iosDeveloper

相關問題