tarBar

//

//  AppDelegate.m

//  UI-NO-10

//

//  Created by Bruce on 15/7/28.

//  Copyright (c) 2015年 Bruce. All rights reserved.

//

#import "AppDelegate.h"

#import "ViewController.h"

#import "NewsViewController.h"

#import "UserInfoViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//    导航栏  UINavigationController

//    菜单栏  UITabBarController  提供选择进入哪一个页面

//    通过一个数组  里面存储的  是 视图控制器

//    UITabBarController 也是一个UIViewController

self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];

ViewController *group = [[ViewController alloc]init];

NewsViewController *news = [[NewsViewController alloc]init];

UserInfoViewController *userInfo = [[UserInfoViewController alloc]init];

//    菜单栏

UITabBarController *tabBarController = [[UITabBarController alloc]init];

//    通过改变tabBarController的轨道的颜色  来改变  按钮的颜色

tabBarController.view.tintColor = [UIColor whiteColor];

tabBarController.viewControllers = @[group,news,userInfo];

//    图片标题的数组

NSArray *titles = @[@"圈子",@"新闻",@"个人中心"];

for (int i=0; i<titles.count; i++) {

//    找到UITabBarController里面的  菜单栏视图 再找到  里面的 tabBarItem 的数组  数组里面存的是 视图控制器的数组  对应的按钮

UITabBarItem *groupItem = tabBarController.tabBar.items[i];

//    设置TabBarItem的标题

groupItem.title = titles[i];

//    设置TabBarItem的图片

groupItem.image = [UIImage imageNamed:titles[i]];

}

//  默认选项

tabBarController.selectedIndex = 1;

self.window.rootViewController = tabBarController;

[self.window makeKeyAndVisible];

return YES;

}

- (void)applicationWillResignActive:(UIApplication *)application {

// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

}

- (void)applicationDidEnterBackground:(UIApplication *)application {

// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.

// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

}

- (void)applicationWillEnterForeground:(UIApplication *)application {

// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

}

- (void)applicationDidBecomeActive:(UIApplication *)application {

// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

}

- (void)applicationWillTerminate:(UIApplication *)application {

// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

}

@end

时间: 2024-08-02 22:55:54

tarBar的相关文章

ios NavBar+TarBar技巧

NavBar+TarBar iphone开发 NavBar+TarBar 1  改变NavBar颜色:选中Navigation Bar 的Tint属性.选中颜色. 2  隐藏“back”按钮: self.navigationItem.hidesBackButton = YES; 3 隐藏"NavBar" : self.navigationController.navigationBarHidden = YES; 4 可以不用MainWindow.xib创建的Navigation.在每个

自定义tarBar

使用tarBar大多数情况在我们都是默认的tarBarButton尺寸和位置但是如果我们想,希望像新浪微博那样的tarBar,就需要自定义了. 1.本质上其实就是通过我们的主控制器中以KVC的方式重新构造我们新的tarBar,(http://www.cnblogs.com/daomul/p/4581717.html) //更换系统的tabBar(KVC的形式,即使是只读的也可以修改) XBTabBar *tarBar = [[XBTabBar alloc]init]; tarBar.delega

ios开发之NavBar和TarBar使用技巧

1  改变NavBar颜色:选中Navigation Bar 的Tint属性.选中颜色. 2  隐藏“back”按钮: self.navigationItem.hidesBackButton = YES; 3 隐藏"NavBar" : self.navigationController.navigationBarHidden = YES; 4 可以不用MainWindow.xib创建的Navigation.在每个view上自定义. 需要把每个控制页都加上以下代码来隐藏nav: -(vo

01uni-app的创建 运行在不同端上的配置 tarBar的配置

uni-app的创建 01==>创建uni-app的项目非常简单.不需要注意什么注意点哈!! 创建项目的时候 可以参考官网 https://uniapp.dcloud.io/quickstart 在使用uni-app的时候,你要创建下载huildex 和微信小程序开发者工具 在你使用HUilderX编译的过程中第一次大概需要五分钟 02==>运行uni-app 在浏览器中可以直接运行H5版本 03==>如何运行到小程序上 配置小程序运行的路径 我的是 E:\开发工具\xiaocehngx

0921 TarBar&amp;枚举 蓝懿

请求 用的是一个类似网址的东西 拿到的是JSON文件 NSString *path =[NSString stringWithFormat:@"http://apis.juhe.cn/cook/query?key=80996127f667eac43832103850b3b13a&menu=%@",self.accStr]; path=  [path   stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]

【新浪微博项目】05--自定义TabBarButton

1.TabBar的层次结构 2.自定义TabBar的背景 可以将一个很短的图片拉长作为背景图片,方法: self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageWithName:@"tabbar_background"]]; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { if (!iOS7) { /

iOS UI进阶-1.1网易彩票框架搭建-代码重构

在上一篇中,我们基本已经把整个框架都搭建出来了,下面进行代码重构一下. 思路: 导航按钮,按下时,会变灰,那是系统自带了,通过自定义UIButton,实现按下按钮立即切换效果. MJTabBarController管得太多了,只需要传图片过去,即创建好一个TabBar. 通过代理实现底部tabbar的切换. 一.自定义UIButton,继承自UIButton.MJTabBarButton.m #import "MJTabBarButton.h" @implementation MJTa

小程序遇坑

1.首先无法直接操作dom 脚本逻辑是放在JsCore中运行的,jscore是一个没有窗口对象的环境,所以无法在脚本中使用window,渲染页面只能重新获取数据渲染页面, 因此做到一些下滑加载更多数据时,需要将原本数据存下来,再将新获取数据与原数据进行去重排序(或不需要)整合渲染. 2.scroll-view 如进行聊天操作时,需将最新消息显示在底部,所以获取消息都应将scroll-top显示最底部(99999之类),但实际设置后并无反映. 测试后发现,不能将页面数据与scroll-top数据同

iOS_CNBlog项目开发 (基于博客园api开发)

按照惯例, 先上效果图 前言 很巧, 做这个项目是因为刚好在逛博客园的时候看到一篇文章 博客园第三方客户端-i博客园正式发布App Store, 这里就帮忙贴下链接啦, 毕竟我是由此而想说做这个项目的. 然而更巧的是, 和那篇文章的作者一样, 我也是刚毕业要找实习的人了(/(ㄒoㄒ)/~~), 开发容易找工不易, 哎, 做个项目练练手吧. 然后, 整个项目做下来大概做了半个月吧, 今天算是做出1.0版本啦, 已经贴上github(https://github.com/samAroundGitHu