当前位置: 首页 > news >正文

网站建设论文范文常州建设网站公司哪家好

网站建设论文范文,常州建设网站公司哪家好,网页设计分几个步骤,淄博高效网站建设文章目录 一、前言二、UIViewController三、UINavigationController四、UITabBarController五、UIPageViewController六、拓展阅读 一、前言 iOS 界面开发最重要的首属ViewController和View#xff0c;ViewController是View的控制器#xff0c;也就是一般的页面#xff0c;… 文章目录 一、前言二、UIViewController三、UINavigationController四、UITabBarController五、UIPageViewController六、拓展阅读 一、前言 iOS 界面开发最重要的首属ViewController和ViewViewController是View的控制器也就是一般的页面用来管理页面的生命周期它相当于安卓里的Activity两者很像但又有一些差异。 ViewController的特点是它有好几种。一种最基本的UIViewController和另外三种容器UINavigationController、UITabBarController、UIPageViewController。 所谓容器就是它们本身不能单独用来显示必须在里面放一个或几个UIViewController。 不同容器有不同的页面管理方式和展示效果 UINavigationController 用于导航栏管理页面UITabBarController 用于底部tab管理页面UIPageViewController 用于切换器管理页面 容器还可以嵌套比如把UITabBarController放进UINavigationController里面这样在tab页面里可以用启动导航栏样式的二级子页面。 二、UIViewController 这是最简单的页面没有导航栏。 使用present方法展示展示时从底部弹起可以用下滑手势关闭也可以多次启动叠加多个页面。 代码实现如下 class ViewController: UIViewController {override func viewDidLoad() {super.viewDidLoad()// Do any additional setup after loading the view.title \(self.hash)var label UIButton(frame: CGRect(x: 10, y: 100, width: 300, height: 100))label.setTitle(present ViewController, for: .normal)view.addSubview(label)label.addTarget(self, action: #selector(presentVC), for: .touchUpInside)label UIButton(frame: CGRect(x: 10, y: 200, width: 300, height: 100))label.setTitle(present NavigationController, for: .normal)view.addSubview(label)label.addTarget(self, action: #selector(presentNC), for: .touchUpInside)label UIButton(frame: CGRect(x: 10, y: 300, width: 300, height: 100))label.setTitle(push ViewController, for: .normal)view.addSubview(label)label.addTarget(self, action: #selector(pushVC), for: .touchUpInside)label UIButton(frame: CGRect(x: 10, y: 400, width: 300, height: 100))label.setTitle(present TabbarController, for: .normal)view.addSubview(label)label.addTarget(self, action: #selector(presentTC), for: .touchUpInside)label UIButton(frame: CGRect(x: 10, y: 500, width: 300, height: 100))label.setTitle(present PageViewController, for: .normal)view.addSubview(label)label.addTarget(self, action: #selector(presentPC), for: .touchUpInside)}objc func presentVC() {let vc ViewController()vc.view.backgroundColor .darkGraypresent(vc, animated: true)}objc func presentNC() {let vc ViewController()vc.view.backgroundColor .graylet nc UINavigationController(rootViewController: vc)present(nc, animated: true)}objc func presentTC() {let tc MyTabbarController()tc.view.backgroundColor .bluelet nc UINavigationController(rootViewController: tc)present(nc, animated: true)}objc func presentPC() {let pc MyPageViewController()pc.view.backgroundColor .redlet nc UINavigationController(rootViewController: pc)present(nc, animated: true)}objc func pushVC() {let vc ViewController()vc.view.backgroundColor .purpleif let nc navigationController {nc.pushViewController(vc, animated: true)} else {print(navigationController nil!)}} }三、UINavigationController 这是最常用的页面导航方式顶部展示导航栏有标题、返回按钮。 使用pushViewController方法展示展示时从右往左出现可以用右滑手势关闭也可以多次启动叠加多个页面。 注意⚠️UINavigationController用来管理一组UIViewController这些UIViewController共用一个导航栏。 一般来说UINavigationController能很好地控制导航栏上面的元素显示和转场效果。 如果需要定制导航栏元素尽量修改UIViewController的导航栏不要直接修改UINavigationController的导航栏。 四、UITabBarController 这个一般用来做主页面的展示下面配置多个tab用于切换页面。 示例代码如下 class MyTabbarController: UITabBarController {init() {super.init(nibName: nil, bundle: nil)self.tabBar.backgroundColor .graylet vc1 ViewController()vc1.tabBarItem.image UIImage(named: diamond)vc1.tabBarItem.title tab1vc1.view.backgroundColor .redlet vc2 ViewController()vc2.tabBarItem.image UIImage(named: diamond)vc2.tabBarItem.title tab2vc2.view.backgroundColor .bluelet vc3 ViewController()vc3.tabBarItem.image UIImage(named: diamond)vc3.tabBarItem.title tab3vc3.view.backgroundColor .purpleself.viewControllers [vc1,vc2,vc3,]}required init?(coder: NSCoder) {fatalError(init(coder:) has not been implemented)} }五、UIPageViewController 这个用来做翻页的页面比如电子书或者广告banner。可以配置左右或上下翻译翻页效果可以配置滚动或者模拟翻书。 用viewControllerBefore和viewControllerAfter回调方法控制页面切换。viewControllerBefore方法提供当前页面的前一个页面viewControllerAfter方法提供当前页面的后一个页面。 注意⚠️UIPageViewController有预加载机制它会提前加载当前页面的前后页面。但是没有实现页面缓存机制需要在外部做缓存。 如果页面非常多但又是同一个类的实例那么一般创建三个实例就够了然后在viewControllerBefore和viewControllerAfter方法里循环使用这三个。 示例代码如下 class MyPageViewController: UIPageViewController, UIPageViewControllerDataSource {lazy var vcs [ViewController(),ViewController(),ViewController(),ViewController(),ViewController(),]init() {super.init(transitionStyle: .scroll, navigationOrientation: .horizontal)self.dataSource selflet vc1 ViewController()vc1.view.backgroundColor .redlet vc2 ViewController()vc2.view.backgroundColor .bluelet vc3 ViewController()vc3.view.backgroundColor .purplelet vc4 ViewController()vc4.view.backgroundColor .grayvcs [vc1,vc2,vc3,vc4]self.setViewControllers([vcs[0]], direction: .forward, animated: false)}required init?(coder: NSCoder) {fatalError(init(coder:) has not been implemented)}func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) - UIViewController? {let i (vcs.firstIndex(of: viewController as! ViewController) ?? 0) - 1if i 0 {return nil}return vcs[i]}func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) - UIViewController? {let i (vcs.firstIndex(of: viewController as! ViewController) ?? 0) 1if i vcs.count {return nil}return vcs[i]} }六、拓展阅读 《iOS开发进阶十viewController生命周期讲解》
http://www.pierceye.com/news/92083/

相关文章:

  • 厦门建设网站的公司php除了写网站吗
  • 如何做全网影视网站居然之家装修公司怎么样
  • 佛山网站建设公司哪家最好万能软文范例800字
  • 网站排名优化如何做wordpress 免费版广告
  • 拓客网站建设建易网官网
  • 网站目录链接怎么做的建网站pc版 (报价)
  • 北京网站制作业务如何开展做网站海报
  • 网站的设计方法有哪些互动网络游戏公司网站建设
  • 公司网站开发制作公司国内重大新闻2022
  • 搜索引擎排名网站北京到广州快递要几天
  • 制作网站怎么制作html网站 下载
  • 深圳网络营销网站设计做个网站哪里可以做
  • 九牛科技网站开发微信营销小型网站建设步骤
  • 分类信息系统网站模板口碑好的网站建设多少钱
  • 米粒网站建设网站开发项目费用预算
  • 12380网站建设的意见建议公司网站维护和更新属于哪个部门
  • 公众号做微网站吗做国外网站的站长
  • 现在网站优化app程序开发定制
  • 德阳网站怎么做seowordpress app 插件
  • 水文化建设网站网站排名优化公司哪家好
  • 网站图片的暗纹是怎么做的做家教中介 不建网站怎么做
  • 学校网站建设价格明细表淮安网站网站建设
  • 怎样做代刷网站长电子商务网站开发费用入账
  • 网站健设推广产品多少钱商业网站开发的实训小结怎么写
  • 优秀的网站建设推荐做百度推广是网站好还是阿里好
  • 响应式网站开发费用做不规则几何图形的网站
  • 西安网站建设优化集团门户网站建设不足
  • 深圳建网站的公企业做网站有什么用
  • wordpress插件 2017南宁seo排名外包
  • 在淘宝上开网店的详细步骤丹东网站seo