小编pas*_*skl的帖子

UITableView在单元格选择上更改图像并重置其他图像

当用户选择行时,我想更改a UIImage里面的内容UITableViewCell.多数民众赞成在现在太难了.我可以做得didSelectRowAtIndex很好.然而,继续问题,我希望其他单元格(每个单元格cell都有标准图像)再次获得标准图像.(如果单元格再次具有标准图像,则应"标记"所选图像(意味着未标记的图像将被标记的图像替换,我已经有了代码)

把它看成是Checkbox你所知道的HTML.

这是我的尝试:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView cellForRowAtIndexPath:indexPath];
    [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:YES];

    //Little flashing animation
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    [UIView animateWithDuration:2.0f animations:^{

    } completion:^(BOOL finished) {
        ;
    }];

    //Mark the selected cell
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    ALog(@"%i", cell.imageView.tag);
    ALog(@"%i", [[[tableView cellForRowAtIndexPath:indexPath] imageView] tag]);

    UIImageView *iconimgView = (UIImageView *)[[tableView cellForRowAtIndexPath:indexPath] viewWithTag:TAG_IMAGEMARKERCELL];
    [iconimgView setImage:[UIImage imageNamed:@"circle-answer-marked.png"]];

    //..
}
Run Code Online (Sandbox Code Playgroud)

UIImageView这里定义:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static …
Run Code Online (Sandbox Code Playgroud)

objective-c uitableview uiimageview ios

4
推荐指数
1
解决办法
6873
查看次数

UIFont:字体大小不同

我通过自定义函数subviewsUILabels我内部的所有(例如)设置自定义字体view.但是,如果我尝试UILabels仅针对特定通道更正字体大小

[lbl_EXAM_Statistics setFont:[UIFont fontWithName:@"PTSans-Regular" size:13]];
Run Code Online (Sandbox Code Playgroud)

13点似乎与Screendesign给我的一点点"太小".在psd文件中然而它的确是13pt.

为什么13pt字体大小与我的应用程序中的13pt字体大小不同?

在屏幕截图中,上面的文字来自psd文件,底部来自iphone模拟器.

如果我想接近从Screendesign到我的应用程序的文本大小,我将不得不使用18pt - 但我不能浪费时间玩如何获得精确的pt,这是一个巨大的时间浪费与我所有的字体大小直接指定.所以必须有更好的方法.

在此输入图像描述

uifont ios

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

正则表达式的最大长度是多少?

我想知道:正则表达式(本身)是否有限?我不是说我如何缩短字符串长度,而是正则表达式本身.

在数组中有几百个值我尝试从它构建正则表达式(目前只有这一半是600多个字符),但还有更多.

所以我的正则表达式将来可能会有1000甚至更长.它仅受PHP字符串长度限制的限制还是还有其他的东西在起作用?

php regex

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

标签 统计

ios ×2

objective-c ×1

php ×1

regex ×1

uifont ×1

uiimageview ×1

uitableview ×1