MFMailCompose 自定义按钮
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cancel.png"]]];
button.target = picker.navigationBar.topItem.leftBarButtonItem ;
button.action = picker.navigationBar.topItem.leftBarButtonItem.action;
picker.navigationBar.topItem.leftBarButtonItem=button;
大家好,我正在尝试更改邮件编辑器按钮的样式。上面的代码确实改变了按钮的外观,但是操作似乎丢失了。我有什么想法可以克服这个问题吗?谢谢。
UIBarButtonItem *button = [[UIBarButtonItem alloc] initWithCustomView:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"cancel.png"]]];
button.target = picker.navigationBar.topItem.leftBarButtonItem ;
button.action = picker.navigationBar.topItem.leftBarButtonItem.action;
picker.navigationBar.topItem.leftBarButtonItem=button;
Hi folks, I'm trying to change the style of the buttons of the mail composer. The above code does change the look of the button, however the action seems to be lost. Any ideas how I can overcome this? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决这个问题相当简单。您向该按钮添加一个方法,然后定义该方法中应该发生什么。因此,首先,在声明按钮之后放置此行。
这将添加一个在单击/触摸按钮时调用的方法。然后,稍后在代码中创建按钮将调用的实际方法。
希望这有帮助:)
The fix for this is fairly simple. You add a method to this button and then define what should happen in the method. So first, put this line after you declare your button.
That will add a method to be called when the button is clicked/touched. Then, later in the code, you create the actual method that the button will be calling.
Hope this helped :)