小编gmo*_*mes的帖子

UITableView上的单元格与自定义UITableViewCell之间的间距

我有一个UITableView从XIB文件加载自定义UITableViewCell.一切都工作正常,但我的布局要求单元格(都在一个单独的部分内)之间有间距.有没有机会这样做而不必提高行高?

现在怎么样
现在怎么样

这是怎么回事
这是怎么回事

编辑:
这就是今天的代码

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [[self.cards valueForKeyPath:@"cards"] count];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    [ccTableView setBackgroundColor:[UIColor clearColor]];
    cardsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cardsCell"];

    if(cell == nil){
      NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"cardsCell" owner:self options:nil];
      cell = [topLevelObjects objectAtIndex:0];
    }

    NSString *nmCard = [[self.cards valueForKeyPath:@"cards.name"] objectAtIndex:indexPath.row];
    cell.descCardLabel.text = nmCard;

  return cell;
}
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch objective-c uitableview

8
推荐指数
2
解决办法
2万
查看次数

嵌套的NSUserDefaults数组是读/写的

我有以下数据结构:

- Cards
 -- Item 0
  --- Name: Card Name
  --- Number: Card Number
  --- Type: Card Type
 -- Item 1
  --- Name: Card Name
  --- Number: Card Number
  --- Type: Card Type
...
Run Code Online (Sandbox Code Playgroud)

用户可以根据需要添加任意数量的卡,因此名称,数量和类型是用户定义的.

第一个问题是,如何将此数据写入NSUserDefauls(嵌套如下)

第二个问题是,如何检索此数据并在表格视图中显示每张卡的名称.(我已经设置了tableview并且正在工作,所以这是从NSUserDefaults获取数据的问题).

任何代码示例都很受欢迎.

谢谢

arrays objective-c nsuserdefaults ios

3
推荐指数
1
解决办法
2831
查看次数

无意中删除/ usr/bin/git文件,现在我无法在终端上使用git

我的机器上的git有问题,我不小心从我的系统中删除了/ usr/bin/git.

我的git是通过XCode命令行工具安装的,我找不到重新安装它的方法.

git没有被卸载,git文件被删除了.

有没有办法从XCode或其他地方重新安装命令行工具?或者在哪里我可以将原始git文件再次添加到/ usr/bin?

谢谢

git macos xcode

0
推荐指数
1
解决办法
695
查看次数