在重复方面处理slu is的最佳方法是什么?比如说,slug是一篇博文.似乎标准的slug转换似乎删除了所有非字母数字字符,然后降低了大小写,最后用低分或连字符打破了空格.但是有问题,例如:
标题=> S ..
两个独特的标题有一个重复重复.有没有办法解决这个问题?也许简单的安全符号转换?
但是,我希望它能够从每个标题中获得相同的slug,以防止重复发布项目.
解:
解决方案是从UITableView正确启动,然后将UITableView委托添加到UIViewController,如所选答案中所述.
前言:我几乎阅读了有关此事的所有文章,没有任何建议有帮助.
我正在将UITableViewController的UITableView嵌入到UIViewController中.
我知道除非渲染视图,否则不会调用任何东西,因此我渲染它并且我可以使用NSLog来显示它击中了那些方法.
我尝试在InterfaceBuilder中创建一个UITableViewController并将我的子类设置为自定义类,这样就可以了!但这不是我需要去做的事情.这是我收集/完成的内容:
我在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)