gpt4 book ai didi

iphone - 将后退按钮设置为自定义 UIImage

转载 作者:行者123 更新时间:2023-11-29 03:45:07 25 4
gpt4 key购买 nike

目前,我正在 UIBarButtonItems 中使用我自己的自定义图像,代码如下:

UIButton *profileBarButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 35.0f, 35.0f)];
[profileBarButton setImage:[UIImage imageNamed:@"profile-barbutton.png"] forState:UIControlStateNormal];
[profileBarButton addTarget:self.navigationController action:@selector(toggleMenu) forControlEvents:UIControlEventTouchUpInside];



self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:profileBarButton];

当我有一个定义的操作要调用时,例如呈现模态视图 Controller 并打开编辑模式,这非常有效。但是,我很困惑如何设置从一个 View 返回到另一个 View 的操作,而不是模态?有没有我可以以编程方式调用的特定方法?通常导航 Controller 会处理这个...

最佳答案

要从一个 View 返回到另一个 View ,而不是模态,您可以这样写:

- (void) toggleMenu
{
if (self.navigationController.visibleViewController == self)
{
[self.navigationController popViewControllerAnimated: YES];
}
}

关于iphone - 将后退按钮设置为自定义 UIImage,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17849088/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com