2013-10-22 59 views
1

我创建了我认为是基于文本内容的非常直接的场景。我希望格式是一个标题,然后是一段文本,然后是另一个标题,等等。将标题添加到UITextView

目前我正在使用界面生成器并创建一个标签,然后是一个UITextView,然后是另一个标签,然后是另一个UITextView等等。有没有更好的办法,因为这似乎有点冗长。

感谢

壳牌

+1

你试过使用'UITableView'吗?我相信它会适用于你的情况(每个“UITableViewCell”包含一个'UILabel'和一个'UITextView')。 –

回答

0

你为什么不能尝试用多达部分的UITableView的。

USe titleForHeaderInSection for heading & & UItextField in the Cell。

-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 
     return 1 ; 
    } 

    -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{ 
     return YourNEed; 

    } 

    -(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ 
     // return header_Name accordind to the Sections 
switch (section) { 
     case 0: 
      return @"1st Label"; 
      // ........... 

    }