0
UIView *leftButtonItemView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 30, 30)];
UIImageView *addButtonEmptyImage = [[UIImageView alloc]init];
[addButtonEmptyImage setImage:[UIImage imageNamed:@"black.png"]];
addButtonEmptyImage.frame = CGRectMake(15,0,20,30);
[leftButtonItemView addSubview:addButtonEmptyImage];
[addButtonEmptyImage release];
UIImageView *correctButtonEmptyImage = [[UIImageView alloc]init];
[correctButtonEmptyImage setImage:[UIImage imageNamed:@"black.png"]];
correctButtonEmptyImage.frame = CGRectMake(50,0,20,30);
[leftButtonItemView addSubview:correctButtonEmptyImage];
[correctButtonEmptyImage release];
UIBarButtonItem *leftButtonItem = [[UIBarButtonItem alloc] initWithCustomView:leftButtonItemView];
[leftButtonItemView release];
self.navigationItem.leftBarButtonItem = leftButtonItem;
[leftButtonItem release];
這是我的應用程序的一些來源。我知道NavigationItem有兩個按鈕(左和右)。但我希望能做出三個按鈕。所以我做了一個使用navigationItem的按鈕和另一個使用空白視圖的按鈕。我想單擊correctButtonEmptyImage。但是這是在leftButtonItemView中。即,如果我點擊包含兩個圖像的視圖,我就會看到leftButtonItemView不是correctButtonEmptyImage。幫我。謝謝如何點擊NavigationBar的UIView按鈕?
哦,謝謝。我很抱歉。 – Beomseok 2010-02-09 02:51:41