iOS 开发过程中常出现的一些错误总结

iOS 开发过程中常出现的一些错误总结



1、两个视图控制器之间的跳转

(1)跳转:[self presentModalViewController:control animated:YES];

    返回:[self dismissModalViewControllerAnimated:YES];

(2)

跳转:[self.navigationController  pushViewController:subTableViewController animated:YES];

 返回:[self.navigationController popViewControllerAnimated:YES];


2ios报错】reason: 'Pushing anavigation controller is not supporter  

reason: 'Pushing a navigation controller is not supported'

报上面的错误,原因是:

大家知道,可以将ViewControllerpush到一个 NavigationController中。就像是入栈操作!


将一个NavigationController再次push到NavigationController中时,报错,出現了

reason: 'Pushing a navigation controller isnot supported'

的错误。应该是,NavigationController不支持push进來的对象是NavigationController。NavigationControllerviewController

 

3ios 中UITableViewCell调用pushViewController:没反应(即页面视图控制器之间不能进行跳转)

总结一下使用UINavigationController遇到的一些问题:

(1)self.navigationController==nil

(2)[self.navigationControllerpushViewController: xxxController animate:yes]后没有back按钮;


4Warning:Attempt to present on whose view is not in the window hierarchy!

 Warning: Attempt to present on whose view is not in thewindow hierarchy!

等等这样类似的提示,只要里面提示有 windowhierarchy,都是view hierarchy的理解不到位导致的。

上面的问题都是在一个controller的view还没加到window上的时候又取present另外一个controller,这就相当于在盖楼,2楼还没盖完,直接去盖3楼了,这样肯定是不行。

遇到上面的问题 最直接的解决方法就是在controller的viewDidAppear里面去调用present。这样可以确保view hierarchy的层次结构不乱。

http://blog.csdn.net/sbvfhp/article/details/19826221


5Presentingview controllers on detached view controllers is discouraged

把[self.rootViewControllerpresentViewController:controller animated:YES completion:nil];

改为[self.view.Window.rootViewControllerpresentViewController:controller animated:YES completion:nil];

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
iOS开发中,有许多常用的库和框架可以帮助开发者提高效率和加速开发过程。以下是一些常用的库和框架: 1. Alamofire:一个简洁的网络请求库,提供了一种优雅的方式来进行网络请求和处理响应。 2. SDWebImage:一个用于异步加载和缓存网络图片的库,可以帮助提高图片加载性能,并且具有内存和磁盘缓存机制。 3. AlamofireImage:一个基于Alamofire的图片加载库,提供了一些便捷的方法来加载网络图片并进行缓存。 4. SwiftyJSON:一个轻量级的、灵活的JSON解析库,可以帮助简化处理JSON数据的过程。 5. SnapKit:一个优雅的、轻量级的Auto Layout框架,使用Swift语言提供了一种简化UI布局代码的方式。 6. Realm:一个移动数据库框架,提供了高效的数据存储和查询功能,并且支持对象关系映射(ORM)。 7. AlamofireObjectMapper:一个将Alamofire与ObjectMapper结合使用的库,可以方便地将JSON数据映射到模型对象中。 8. Kingfisher:一个用于异步加载和缓存网络图片的库,具有高性能和功能丰富的特点。 9. RxSwift:一个用于响应式编程的库,可以简化异步编程和事件处理的复杂性。 10. IQKeyboardManager:一个用于处理键盘弹出和收起的库,可以自动管理键盘,提供了一种简单的方式来避免键盘遮挡输入框的问题。 这只是一小部分常用的库和框架,iOS开发中还有许多其他优秀的工具可供选择,根据具体需求选择合适的库和框架进行开发

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值