Welcome, Guest
Username Password: Remember me

How to change the SegmentedControllCell Size
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: How to change the SegmentedControllCell Size

How to change the SegmentedControllCell Size 1 year, 3 months ago #1

How to change the SegmentedControll Cell Size? Below is the screenshot, I need to resize
segmentedcell.jpg
  • rajdn
  • OFFLINE
  • Senior Boarder
  • Posts: 47
  • Karma: 0

Re: How to change the SegmentedControllCell Size 1 year, 3 months ago #2

Hi Raj,

Using STV 2.0 (currently available as an RC version), you can achieve this via two ways:

1- Implement the SCTableViewModelDelegate method tableViewModel:didLayoutSubviewsForCell:forRowAtIndexPath: and resize the cell's segmentedControl in there.

2- Create a custom cell and add a segmented control there with whatever size you want.
  • tarekskr
  • OFFLINE
  • Administrator
  • Posts: 2402
  • Karma: 72

Re: How to change the SegmentedControllCell Size 1 year, 3 months ago #3

Thanks Tarek,

I'm trying the 1st way.I'm trying in the iPad App sample. I tried putting the below code on both the RootViewController(has all the coredata stuff) and DetailViewController. The addbutton is on the detail screen where it adds the new Task

Its not changing.Anything missing? Appreciate your help..

#pragma mark -
#pragma mark SCTableViewModelDelegate methods

- (void)tableViewModel:(SCTableViewModel *) tableViewModel willConfigureCell:(SCTableViewCell *) cell forRowAtIndexPath:(NSIndexPath *) indexPath
{
cell.height = 70;
}

- (void)tableViewModel:(SCTableViewModel *) tableViewModel willDisplayCell:(SCTableViewCell *) cell forRowAtIndexPath:(NSIndexPath *) indexPath
{
cell.imageView.image = [UIImage imageNamed:@"phy.png"];
}

- (void)tableViewModel:(SCTableViewModel *) tableViewModel didLayoutSubviewsForCell:(SCTableViewCell *) cell forRowAtIndexPath:(NSIndexPath *) indexPath
{

if([cell isKindOfClass:[UISegmentedControl class]])
{
NSLog(@"yes its segmented control");
SCSegmentedCell *controlCell = (SCSegmentedCell *)cell;

// Assuming the label's tag equals 1
[controlCell.segmentedControl setWidth:50.0 forSegmentAtIndex:0];
}
}
  • rajdn
  • OFFLINE
  • Senior Boarder
  • Posts: 47
  • Karma: 0
  • Page:
  • 1
Time to create page: 1.32 seconds