簡體   English   中英

xcode和storyboard:如何構建用戶配置文件視圖

[英]xcode and storyboard: how build an user profile view

如何構建這樣的用戶配置文件視圖(Periscope,但與許多其他應用程序類似)。

這是一個tableviewcontroller? 如果是,我怎么能把用戶的圖像放在背景中(它在第一個單元格中或在tableview上方?)

在此輸入圖像描述

我用這種方式構建它:

UIViewControllerUITableView +自定義UIView在上面。

如果您想使用已經實現的庫,請查看:

它們具有與您的問題中描述的非常相似的邏輯。

它是一個自定義的tableviewcontroller。 一切都是細胞,但很難只使用故事板創建。 您為它創建一個動態表視圖和ad 3原型單元格(1:藍色單元格,2:灰色空單元格,3:選項單元格)。 並創建一個控制器並用它管理單元格,如:

       -(UITableViewCell *)tableView:(UITableView *)tableView  cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
      if(indexpath.row== 0)
      {
          HeaderCell *cell = [tableView dequeueReusableCellWithIdentifier:@"headerCell" forIndexPath:indexPath];
          cell.name = "foo";
          ....
      }
      else if(indexpath.row ==1 || indexpath.row ==3)
      {
          UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"blankCell" forIndexPath:indexPath];
          [cell  setBackgroundColor:[UIColor greyColor]];

      }else{
           ....
       }
    }

看起來上面是標題視圖,在表格視圖下方。

如果上面的部分滾動它是表視圖的tableHeaderView 在這種情況下,您可以使用UITableViewController

否則,您將不得不使用UIViewController ,其中UIView作為標題,下面是UITableView ,您必須自己聲明表視圖delegatedatasource

你可以在UITableView幫助下實現相同的UI,並將藍色背景的UIView添加為tableHeaderView ,如下所示。

UIView *headerView =  [[UIView alloc] init...];
tableView.tableHeaderView = headerView;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM