2011-02-02 21 views
1

我想在我的应用程序的所有页面中添加一个小标题标签。 titleLabel看起来像一个实现代码如下节头(如图所示)iOS:如何在所有ViewControllers中添加titleview?

NB:我想这对viewcontrollers比其他的UITableViewController太

enter image description here

如何做到这一点的可重复使用的方式?感谢您提供任何建议或参考链接来阅读。

回答

0

为什么不创建一个你想要的外观的UIView?然后,只要您需要它,只需将该视图添加为子视图即可。

//where "Title" is the view you created 

UIView *title = [[Title alloc] initWithFrame:(CGRectMake(0, 30, 
           self.view.frame.size.width, 
           self.view.frame.size.height))]; 
[self.view addSubview:title]; 
相关问题