2010-07-16 58 views

回答

0

你可以嘗試使用導航欄帶有標題和圖像:

// show image 
    UIImage *image = [UIImage imageNamed: @"bar_icon.png"]; 
    UIImageView *imageView = [[UIImageView alloc] initWithImage: image]; 
    imageView.frame = CGRectMake(70, 0, 40, 40); 
    //self.navigationItem.titleView = imageView; 

    // label 
    UILabel *tmpTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(120, 0, 200, 40)]; 
    tmpTitleLabel.text = @"Mannschaft"; 
    tmpTitleLabel.backgroundColor = [UIColor clearColor]; 
    tmpTitleLabel.textColor = [UIColor whiteColor]; 
    tmpTitleLabel.font = [UIFont boldSystemFontOfSize:18]; 

    // create new view 
    CGRect applicationFrame = CGRectMake(0, 0, 300, 40); 
    UIView * newView = [[[UIView alloc] initWithFrame:applicationFrame] autorelease]; 
    [newView addSubview:imageView]; 
    [newView addSubview:tmpTitleLabel]; 
    self.navigationItem.titleView = newView; 

    [imageView release]; 
    [tmpTitleLabel release];