網頁

2012年5月22日 星期二

iOS5 UIViewController background


ios 5 UINavigationBar bar,UITool bar 等添加背景图



UIViewController 背景圖 利用TableView

相當於UITableViewController的
- (void)viewDidLoad
{
    UIImage *bodyImage = [UIImage imageNamed: @"content_background_body.png"];
    UIImageView *bodyView = [[UIImageView alloc] initWithImage: bodyImage];
    self.tableView.backgroundView = bodyView;
}
以下為UIViewController
@interface Conversation : UIViewController 
{
    UITableView *mainTableView;
}
@property (nonatomic,strong) IBOutlet UITableView *mainTableView;
@synthesize mainTableView;
- (void)viewDidLoad
{
    [super viewDidLoad];

    [self initViewBg];    
}

- (void) initViewBg
{

    self.mainTableView.backgroundColor = [UIColor clearColor];
}


沒有留言:

張貼留言

注意:只有此網誌的成員可以留言。