簡體   English   中英

單擊旁邊的UIBarButtonItem

[英]UIBarButtonItem pressed when clicking next to it

我在應用程序的Web視圖上方顯示一個帶有工具欄和一個按鈕(關閉按鈕)的日期選擇器。 這是代碼:

// create picker view

UIView* container= [[UIView alloc] initWithFrame:CGRectMake([x doubleValue], [y doubleValue], 320.0, 216.0 + 44.0)];
UIToolbar* toolbar= [[UIToolbar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
UIDatePicker* picker= [[UIDatePicker alloc] initWithFrame:CGRectMake(0.0, 0.0 + 44.0, 320.0, 216.0)];

[container addSubview:toolbar];
[container addSubview:picker];
[toolbar release];
[picker release];

UIBarButtonItem* item= [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissPicker:)];

NSArray* buttons = [NSArray arrayWithObjects: item,nil];

[toolbar setItems: buttons animated:NO];
[item release];

[self.webView addSubview:container];

有效,除了當我單擊按鈕右側的20點時觸發按鈕(按下)的事實,甚至當我單擊按鈕右側的5-10點時它甚至觸發動作。 (http://i42.tinypic.com/2nssv0m.jpg)

有人知道為什么會這樣嗎?

對我來說,這是一個已知問題。 您甚至可以看到它與iPhone本地應用程序(例如“郵件”)以及其他應用程序一起使用。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM