对于app而言,一款应用往往涉及到很多的页面,而页面之间的跳转Android和iOS实现也各不相同。在iOS上,系统为我们提供了UINavigationController控件用来专门控制页面的跳转,iOS的实现思路很清晰,为按钮添加action事件,点击之后跳转到指定的页面即可。例如:
//定义一个Button,点击后跳转到另一个页面 UIButton * button=[UIButton buttonWithType:UIButtonTypeSystem]; button.frame=CGRectMake(130, 220, 100, 30); [button addTarget:self action:@selector(toNext) forControlEvents:UIControlEventTouchUpInside]; [button setTitle:@"跳转登录" forState:UIControlStateNormal]; [self< xiangzhihong8 认证博客专家 HTTPS 前端框架 JavaScript 著有《React Native移动开发实战》、《Kotlin入门与实战》、《Weex跨平台开发与实战》、《React Native开发进阶》和《Flutter跨平台开发实战》,正努力完成《Android应用架构实战》