翠欧控制器的程序控制,在VC开发鸡舍智能环境控制器中是怎么实现的

Pages: 1/3
主题 : 如何让UIView中的Button点击之后跳转到另一个ViewController上去
级别: 新手上路
UID: 383816
可可豆: 50 CB
威望: 38 点
在线时间: 839(时)
发自: Web Page
来源于&&分类
如何让UIView中的Button点击之后跳转到另一个ViewController上去&&&
我的UIView,Button是用代码实例化的 ,然后想点击Button之后,跳转到 另一个ViewController上去。 然后这个ViewController上也有一个按钮 可以返回。请教如何实现。
可可豆: * CB
威望: * 点
在线时间: (时)
注册时间: *
最后登录: *
发自: Web Page
如果使用导航第一个按钮方法:[self.navigationController pushViewController:secondVC animated:YES];第二个按钮方法:[self.navigationController popViewControllerAnimated:YES];如果使用模态第一个按钮方法:[self presentViewController:secondVC animated:YES completion:nil];第二个按钮方法:[self dismissViewControllerAnimated:YES completion:nil];
级别: 新手上路
UID: 383816
可可豆: 50 CB
威望: 38 点
在线时间: 839(时)
发自: Web Page
回 1楼(rainckoo) 的帖子
谢谢!搞定了
级别: 新手上路
UID: 434395
可可豆: 3 CB
威望: 6 点
在线时间: 3(时)
发自: Web Page
回 2楼(m) 的帖子
怎么搞定的
级别: 新手上路
UID: 318536
可可豆: 459 CB
威望: 312 点
在线时间: 644(时)
发自: Web Page
我就搞不明了&&UIView 有[self.navigationController pushViewController:secondVC animated:YES];&&这方法吗
个性是一种生活态度
级别: 新手上路
UID: 454322
可可豆: 55 CB
威望: 44 点
在线时间: 101(时)
发自: Web Page
回 4楼(zhangyiming) 的帖子
代理,block 都可说实话代理不熟,一般自己定义一个UIView 中含有button ,并且button的 是push事件我都用block,回调到调用该view的ViewContronller中用[self.navigationController pushViewController:secondVC animated:YES]&&实现push事件。或者还可以这样假定你的项目中有文件 UIViewContronller1(继承UIViewContronller), UIViewContronller2(继承于UIViewContronller),UIViewWithButon(继承于UIView)UIViewWithButon中有一button在UIViewContronller1中调用UIViewWithButon目的是:点UIViewWithButon上的Button就会从UIViewContronller1 push到 UIViewContronller2实现是:在UIViewWithButon.h文件 @property (nonatomic,strong) UIViewController *在UIViewWithButon.m文件中button 的方法中 [self.owner.navigationController&&pushViewController:[UIViewContronller2 new] animated:YES];在UIViewContronller1,.m中调用UIViewWithButonUIViewWithButon *buttonView = [[UIViewWithButon alloc]initwith...];buttonView.owner = 可以了,有点乱,要是有问题,加我企鹅,
级别: 新手上路
UID: 516679
可可豆: 72 CB
威望: 43 点
在线时间: 73(时)
发自: Web Page
回 4楼(zhangyiming) 的帖子
就是啊 view上面的button怎么能用点语法点出navigationController
谁都有一个成长的过程,我相信只要坚持下去,终有一番作为
级别: 新手上路
可可豆: 9 CB
威望: 9 点
在线时间: 177(时)
发自: Web Page
回 6楼(何乐不为) 的帖子
view 上的button是不能点出navigationController&&viewController加了导航控制器(navBar)以后就可以,如果单纯的通过button点击方法就跳转的话 模态视图可以跳转:[self presentViewController:&#(UIViewController *)#& animated:&#(BOOL)#& completion:&#^(void)completion#&];跳回方法:&& [self dismissViewControllerAnimated:&#(BOOL)#& completion:&#^(void)completion#&];还可以通过容器视图控制器来实现页面之间的跳转
级别: 版主
UID: 512733
可可豆: 2865 CB
威望: 2186 点
在线时间: 1256(时)
发自: Web Page
回 1楼(rainckoo) 的帖子
级别: 新手上路
UID: 520884
可可豆: 226 CB
威望: 127 点
在线时间: 35(时)
发自: Web Page
用导航的话第一个UIview的Button: push过去第二个UIview的Button:pop回来用模态的话第一个UIview的Button点击方法:[self presentViewController:secondVC animated:YES completion:nil];第二个UIview的Button点击方法:[self dismissViewControllerAnimated:YES completion:nil];
Pages: 1/3
关注本帖(如果有新回复会站内信通知您)
发帖、回帖都会得到可观的积分奖励。
按"Ctrl+Enter"直接提交
关注CocoaChina
关注微信 每日推荐
扫一扫 关注CVP公众号
扫一扫 浏览移动版iOS开发过程中怎么知道当前视图控制器是怎么来的? - 知乎5被浏览<strong class="NumberBoard-itemValue" title="分享邀请回答/*
These four methods can be used in a view controller's appearance callbacks to determine if it is being
presented, dismissed, or added or removed as a child view controller. For example, a view controller can
check if it is disappearing because it was dismissed or popped by asking itself in its viewWillDisappear:
method by checking the expression ([self isBeingDismissed] || [self isMovingFromParentViewController]).
- (BOOL)isBeingPresented NS_AVAILABLE_IOS(5_0);
- (BOOL)isBeingDismissed NS_AVAILABLE_IOS(5_0);
- (BOOL)isMovingToParentViewController NS_AVAILABLE_IOS(5_0);
- (BOOL)isMovingFromParentViewController NS_AVAILABLE_IOS(5_0);
有一点需要注意的是如果你是 present 到一个 UINavigationController 的时候,你应该使用后两个方法。还有别的方法,比如检查 push 或 pop 可以实现 UINavigationController 的代理方法:- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
检测 present 或 dismissed 可以逐级检查 UIViewController 的 presentingViewController 属性等。------------------------------------------------------------------------吐槽一下不支持 MarkDown 真是对标记短代码很不友好。1添加评论分享收藏感谢收起0添加评论分享收藏感谢收起写回答翠欧程序练习_百度文库
赠送免券下载特权
10W篇文档免费专享
部分付费文档8折起
每天抽奖多种福利
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
翠欧程序练习
阅读已结束,下载本文需要
想免费下载更多文档?
定制HR最喜欢的简历
下载文档到电脑,同时保存到云知识,更方便管理
&#xe64e;加入VIP
还剩6页未读,
定制HR最喜欢的简历
你可能喜欢运动控制器的程序设计_百度文库
赠送免券下载特权
10W篇文档免费专享
部分付费文档8折起
每天抽奖多种福利
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
运动控制器的程序设计
阅读已结束,下载本文需要
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,同时保存到云知识,更方便管理
&#xe64e;加入VIP
还剩7页未读,
定制HR最喜欢的简历
你可能喜欢

我要回帖

更多关于 鸡舍智能环境控制器 的文章

 

随机推荐