use table view disclosure indicator style for uibutton ios

use table view disclosure indicator style for uibutton ios  using -'ios,uibutton'

I have a custom view and i want to imitate the disclosure indicator found in table view cells. Is this possible ? Is there anyway of extracting that image ?

asked Sep 15, 2015 by Dorothea3038
0 votes

5 Answers

0 votes

Note that you must use a transparent background

Here's the best possible match I can get, in a photoshop file:

Note that it includes the REAL iOS IMAGE (from a screenshot) underneath as a layer, so you can compare.

It seems like VBK wants the single chevron from the UITableView collection. Which is called 'Disclosure Indicator' as opposed to the one available from UIButton which is 'Detail Disclosure'.

I think you want something like this:

UITableView Disclosure Indicator Image for Buttons

It is 50x80 with a transparent background. Use this image on top of a button or UIImageView. Resize it to whatever size you'd like your button to be. Apple recommends a hit target of no less than 40x40. I sized it to 10x16 in my storyboard, but I am using a transparent button overlay so the size doesn't matter.

Image Mirror :

Just note however this is not precisely the image used in iOS7. (Nov 2013.) To get the exact image, simply run an app in retina in your simulator, and make a screenshot.

answered Sep 15, 2015 by VeroniquHanl
0 votes

This worked for me:

UITableViewCell *disclosure = [[UITableViewCell alloc] init];
disclosure.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
for (UIView*v1 in disclosure.subviews)
   if ([v1 isKindOfClass:[UIButton class]])
       for (UIView*v2 in v1.subviews)
           if ([v2 isKindOfClass:[UIImageView class]])
               return ((UIImageView*)v2).image;
answered Sep 15, 2015 by IdaThieluwu
0 votes

This can be done entirely with code by placing a UITableViewCell with the disclosure indicator within a UIButton:

UITableViewCell *disclosure = [[UITableViewCell alloc] init];
[button addSubview:disclosure];
disclosure.frame = button.bounds;
disclosure.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
disclosure.userInteractionEnabled = NO; 
answered Sep 15, 2015 by UceMilne
0 votes

You can add any custom image on the right side of UITableViewCell with a single line of Code:

Try This:

-(UITableViewCell *)tableView:(UITableView *)tableView 
cellForRowAtIndexPath:(NSIndexPath *)indexPath
    cell.accessoryView = [[UIImageView alloc]initWithImage:
    [UIImage imageNamed:@"blueButton.png"]];
answered Sep 15, 2015 by JayneBeasley
0 votes

For Xamarin.iOS

//create your button
var systolicWell = new UIButton(UIButtonType.RoundedRect);
systolicWell.BackgroundColor = UIColor.White;

//create the UITableViewCell
var systolicDisclosure = new UITableViewCell();
systolicDisclosure.Accessory = UITableViewCellAccessory.DisclosureIndicator;
systolicDisclosure.UserInteractionEnabled = false;

//add the button, then the UITableViewCell to the View
View.AddSubviews(systolicWell, systolicDisclosure);

//using FluentLayout


answered Sep 15, 2015 by CaiBaine