文章转自:http://blog.youkuaiyun.com/lizhongfu2013/article/details/9133281
1、UINavigationBar:
NSDictionary* attrs = @{NSForegroundColorAttributeName: [UIColorblackColor],
NSFontAttributeName: [UIFontfontWithName:@"AmericanTypewriter"size:0.0],
};
[[UINavigationBar appearance] setTitleTextAttributes:attrs];
[[UINavigationBar appearance] setTintColor:[UIColorredColor]];
UINavigationBar *navBar = [[UINavigationBaralloc]init];
navBar.frame = CGRectMake(0,50,320, 44);
[navBar pushNavigationItem:[[UINavigationItemalloc]initWithTitle:@"Test"]animated:YES];
[navBar pushNavigationItem:[[UINavigationItemalloc]initWithTitle:@"Test"]animated:YES];
[navBar pushNavigationItem:[[UINavigationItemalloc]initWithTitle:@"Test"]animated:YES];
[navBar pushNavigationItem:[[UINavigationItemalloc]initWithTitle:@"Test"]animated:YES];
[navBar setBarStyle:UIBarStyleDefault];
[navBar setBackgroundImage:[UIImageimageNamed:@"bg.png"]forBarMetrics:UIBarMetricsDefault];
[self.view addSubview:navBar];
2、UIProgressView:
{
progress = [[UIProgressViewalloc]initWithFrame:CGRectMake(10,100,300,10)];
[progresssetProgressImage:[UIImageimageNamed:@"bg.png"]];
[progresssetProgressViewStyle:UIProgressViewStyleBar];
[progresssetTrackImage:[UIImageimageNamed:@"sss.png"]];
[self.viewaddSubview:progress];
[NSTimer scheduledTimerWithTimeInterval:1.0target:selfselector:@selector(run)userInfo:nilrepeats:YES];
}
-(void) run
{
progress.progress +=0.1;
[progresssetProgress:progress.progressanimated:YES];
}
2、UISearchbar:
UISearchBar *searchBar = [[UISearchBaralloc]initWithFrame:CGRectMake(0,20,320,44)];
[searchBar setBarStyle:UIBarStyleDefault];
[searchBar setBarTintColor:[UIColorredColor]];
[searchBar setBackgroundImage:[UIImageimageNamed:@"bg.png"]
forBarPosition:UIBarPositionAny
barMetrics:UIBarMetricsDefault];
searchBar.showsCancelButton =YES;
[self.view addSubview:searchBar];
本文介绍如何在iOS应用中定制UINavigationBar的样式,包括字体颜色、背景图片等;展示了UIProgressView的使用方法,包括设置进度条样式、图片及动态更新进度;并介绍了UISearchBar的基本配置。
8842

被折叠的 条评论
为什么被折叠?



