Ios 黑色UITableViewCell附件按钮?

Ios 黑色UITableViewCell附件按钮?,ios,iphone,objective-c,uitableview,Ios,Iphone,Objective C,Uitableview,有没有办法将默认的UITableViewCellAccessoryDetailDispositionButton附件按钮从蓝色变为黑色?没有“标准”的黑色按钮,但按照您的要求做的工作并不多 创建(在photoshop或类似的软件中)你自己的详细信息披露按钮的黑色版本。如果方便的话,你可以抓取屏幕并把它涂上颜色。然后将其作为资源添加到项目中,并将其放入UIImage中,如下所示: UIImage myImage = [UIImage imageNamed:@"blackbutton.png"];

有没有办法将默认的
UITableViewCellAccessoryDetailDispositionButton
附件按钮从蓝色变为黑色?

没有“标准”的黑色按钮,但按照您的要求做的工作并不多

创建(在photoshop或类似的软件中)你自己的详细信息披露按钮的黑色版本。如果方便的话,你可以抓取屏幕并把它涂上颜色。然后将其作为资源添加到项目中,并将其放入UIImage中,如下所示:

UIImage myImage = [UIImage imageNamed:@"blackbutton.png"];
然后创建包含该图像的UIImageView:

UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
最后,您可以将其指定给已设置单元的“附件视图”:

[cell setAccessoryView:imageView];
希望有帮助

//编辑-我想在photoshop中快速使用5分钟,因此为您创建了一个黑色的。玩得开心

删除了死掉的ImageShack链接

没有“标准”的黑色链接,但按照您的要求做的工作并不多

创建(在photoshop或类似的软件中)你自己的详细信息披露按钮的黑色版本。如果方便的话,你可以抓取屏幕并把它涂上颜色。然后将其作为资源添加到项目中,并将其放入UIImage中,如下所示:

UIImage myImage = [UIImage imageNamed:@"blackbutton.png"];
然后创建包含该图像的UIImageView:

UIImageView *imageView = [[UIImageView alloc] initWithImage:myImage];
最后,您可以将其指定给已设置单元的“附件视图”:

[cell setAccessoryView:imageView];
希望有帮助

//编辑-我想在photoshop中快速使用5分钟,因此为您创建了一个黑色的。玩得开心


删除了死掉的ImageShack链接

在iOS 5.1.1中,h4xxr的答案对我来说并不完全有效(单击附件视图不会调用
tableView:accessoryButtonTappedForRowWithIndexPath
方法),因此我在这个相关的,对图像使用
ui按钮
,而不是使用
ui视图
,单击该视图可以调用自定义选择器:

UIImage *myImage = [UIImage imageNamed:@"blackaccessorybutton.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, myImage.size.width, myImage.size.height);
[button setImage:myImage forState:UIControlStateNormal];
[button addTarget: self
           action: @selector(toggleCustomDetailDisclosureButton:)
 forControlEvents: UIControlEventTouchUpInside];
[cell setAccessoryView:button];

在iOS 5.1.1中,h4xxr给出的答案对我来说并不完全有效(单击附件视图不会调用
tableView:accessoryButtonTappedForRowWithIndexPath
方法),因此我在相关帮助下更改了他的解决方案,使用带有图像的
UIButton
,而不是
UIView
,如果单击,则可以调用自定义选择器:

UIImage *myImage = [UIImage imageNamed:@"blackaccessorybutton.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.frame = CGRectMake(0, 0, myImage.size.width, myImage.size.height);
[button setImage:myImage forState:UIControlStateNormal];
[button addTarget: self
           action: @selector(toggleCustomDetailDisclosureButton:)
 forControlEvents: UIControlEventTouchUpInside];
[cell setAccessoryView:button];

在iOS7上有一个更简单的解决方案。使用
UIView
上的
tintColor
属性。子类通常倾向于尊重它,披露指标也不例外

UIView *v = [[cell subviews] lastObject];
        v = v.subviews.count ? [v.subviews objectAtIndex:0] : nil; // v is the disclosure indicator
        if ([v respondsToSelector:@selector(setTintColor:)])
            v.tintColor = [UIColor greenColor];

在iOS7上有一个更简单的解决方案。使用
UIView
上的
tintColor
属性。子类通常倾向于尊重它,披露指标也不例外

UIView *v = [[cell subviews] lastObject];
        v = v.subviews.count ? [v.subviews objectAtIndex:0] : nil; // v is the disclosure indicator
        if ([v respondsToSelector:@selector(setTintColor:)])
            v.tintColor = [UIColor greenColor];

它是28x28-我已经为你创建了一个,并在我的主要帖子中链接到它。希望这能帮你做个好手势。SO上的人都很棒。它是28x28-我已经为你创建了一个,并在我的主要帖子中链接到它。希望这能帮你做个好手势。这样的人很伟大。