小编fil*_*m42的帖子

从标题中生成独特的slu ..

在重复方面处理slu is的最佳方法是什么?比如说,slug是一篇博文.似乎标准的slug转换似乎删除了所有非字母数字字符,然后降低了大小写,最后用低分或连字符打破了空格.但是有问题,例如:

标题=> S ..

  1. 500强体育活动=> 500强体育活动
  2. 最高$ 500体育活动=> 500强体育活动

两个独特的标题有一个重复重复.有没有办法解决这个问题?也许简单的安全符号转换?

但是,我希望它能够从每个标题中获得相同的slug,以防止重复发布项目.

database slug web

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

UITableViewController不会调用cellForRowAtIndexPath但是numberOfSectionsInTableView和numberOfRowsInSection设置正确

解:

解决方案是从UITableView正确启动,然后将UITableView委托添加到UIViewController,如所选答案中所述.

前言:我几乎阅读了有关此事的所有文章,没有任何建议有帮助.

我正在将UITableViewController的UITableView嵌入到UIViewController中.

我知道除非渲染视图,否则不会调用任何东西,因此我渲染它并且我可以使用NSLog来显示它击中了那些方法.

我尝试在InterfaceBuilder中创建一个UITableViewController并将我的子类设置为自定义类,这样就可以了!但这不是我需要去做的事情.这是我收集/完成的内容:

  • 我正在使用InterfaceBuilder来管理UIViewController,但我正在以编程方式添加UITableView
  • delegate和dataSource都设置正确,self.tableView不是nil
  • 尽管有效的日志记录,但从不调用cellForRowAtIndexPath,并且渲染的UITableView为空
  • 我将代表添加到我的控制器,它没有改变任何东西

我在UITableViewController上设置了以下内容:

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    NSLog(@"%@", self.questions); // This outputs the questions array as not empty and works
    // As you can see I am also returning 1.
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSLog(@"%d", [self.questions count]); // This outputs 4 as it should
    return [self.questions count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    // All we need to focus on is this NSLog which never outputs …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview ios

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

标签 统计

database ×1

ios ×1

objective-c ×1

slug ×1

uitableview ×1

web ×1