繁体   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