2013-10-22 201 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"; 
      // ........... 

    }