1
我是新的iphone ...我已經創建了四個按鈕的工具欄...代碼是顯示 下面...我想爲每個按鈕添加背景圖像。任何人幫助我創造這個..創建工具欄按鈕的背景圖像
TransparentToolbar* toolbar = [[TransparentToolbar alloc] initWithFrame:CGRectMake(0, 0, 256, 50)];
[toolbar setBarStyle: UIBarStyleBlackTranslucent];//UIBarStyleBlackTranslucent
toolbar.translucent = YES;
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:4];
UIBarButtonItem *Messages = [[UIBarButtonItem alloc] initWithTitle:@"About Me" style:UIBarButtonItemStyleBordered target:self action:@selector(currentuserdetails:)];
[buttons addObject:Messages];
[Messages release];
UIBarButtonItem *sendMessageBtn = [[UIBarButtonItem alloc] initWithTitle:@"Send Message" style:UIBarButtonItemStyleBordered target:self action:@selector(sendMessage)];
[buttons addObject:sendMessageBtn];
[sendMessageBtn release];
UIBarButtonItem *blockBtn = [[UIBarButtonItem alloc] initWithTitle:@"Block" style:UIBarButtonItemStyleBordered target:self action:@selector(blockcurrentuser:)];
[buttons addObject:blockBtn];
[blockBtn release];
[toolbar setItems:buttons animated:NO];
// place the toolbar into the navigation bar
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:toolbar];
[toolbar release];
TransparentToolbar* toolbar = [[TransparentToolbar alloc] initWithFrame:CGRectMake(0, 0, 256, 50)];
[toolbar setBarStyle: UIBarStyleBlackTranslucent];//UIBarStyleBlackTranslucent
toolbar.translucent = YES;
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:4];
UIBarButtonItem *Messages = [[UIBarButtonItem alloc] initWithTitle:@"About Me" style:UIBarButtonItemStyleBordered target:self action:@selector(currentuserdetails:)];
[buttons addObject:Messages];
[Messages release];
UIBarButtonItem *sendMessageBtn = [[UIBarButtonItem alloc] initWithTitle:@"Send Message" style:UIBarButtonItemStyleBordered target:self action:@selector(sendMessage)];
[buttons addObject:sendMessageBtn];
[sendMessageBtn release];
UIBarButtonItem *blockBtn = [[UIBarButtonItem alloc] initWithTitle:@"Block" style:UIBarButtonItemStyleBordered target:self action:@selector(blockcurrentuser:)];
[buttons addObject:blockBtn];
[blockBtn release];
[toolbar setItems:buttons animated:NO];
// place the toolbar into the navigation bar
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:toolbar];
[toolbar release];
做這樣每個和定製他們這樣 –
感謝...我undestood – sai