小编Adi*_*rin的帖子

拆分后的字符串:和之前?

我有一个像这样的长字符串:

je!tress:e?tu!tress:es?il!tress:e?nous!tress:ons?vous!tress:ez?ils!tress:ent?
Run Code Online (Sandbox Code Playgroud)

我想在之后分割字符串:之前?.所以我想进入数组:

{e,es,e,ons,ez,en}
Run Code Online (Sandbox Code Playgroud)

我知道我可以这样做:

 NSArray *subStrings = [stringToChange componentsSeparatedByString:@":"];
Run Code Online (Sandbox Code Playgroud)

但这还不够.我怎么能这样做呢?任何帮助将不胜感激!

objective-c nsstring ios

7
推荐指数
1
解决办法
87
查看次数

可重复使用的自定义单元格

我有tableView一个custom cell.我有posibility保存到收藏夹中的一些内容,当发生这种情况我想补充一个明星imagecell.我试图这样做,但在明星出现后,我有一个问题.我认为这是因为reusable cell但我不知道如何解决它. 我的问题是: stars appear again on the other cells even if the word is not added on favorites.

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    dictionaryTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell=[[dictionaryTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"];
    }
    if (tableView == self.searchDisplayController.searchResultsTableView)
    {
        cell.textLabel.text = [self.searchResult objectAtIndex:indexPath.row];

    }
    else
    {
        cell.word.text = self.tableData[indexPath.row];
        BOOL isTheObjectThere = [self.favoriteArry containsObject:self.tableData[indexPath.row]];
        if (isTheObjectThere==TRUE) {
             cell.favImg.image=[UIImage imageNamed:@"3081@3x.png"];
        }
    }

        return cell;

}
Run Code Online (Sandbox Code Playgroud)

objective-c cell uitableview ios

5
推荐指数
1
解决办法
67
查看次数

搜索栏单击检测

我有一个搜索栏,我想检测用户何时单击它,以及在用户在搜索栏中编辑时禁用按钮.我怎么能这样做,因为我试图做什么,你会看到上面但它永远不会被召唤.

-(void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
        NSLog(@"yes");
    }
Run Code Online (Sandbox Code Playgroud)

其他方法也searchDisplayController被称为.我也设置

self.searchBar.delegate=self 
Run Code Online (Sandbox Code Playgroud)

但没有结果.

objective-c uisearchbar ios

2
推荐指数
1
解决办法
7917
查看次数

标签 统计

ios ×3

objective-c ×3

cell ×1

nsstring ×1

uisearchbar ×1

uitableview ×1