/Frameworks/UIKit/MNStepperTableViewCell.m

https://bitbucket.org/aquarius/mnkit/ · Objective C · 67 lines · 38 code · 22 blank · 7 comment · 1 complexity · fc4c78df5301bec3a02b9ca2cfe72068 MD5 · raw file

  1. //
  2. // MNSizeSelectionTableViewCell.m
  3. // MindNodeTouch
  4. //
  5. // Created by Markus Müller on 22.03.11.
  6. // Copyright 2011 __MyCompanyName__. All rights reserved.
  7. //
  8. #import "MNStepperTableViewCell.h"
  9. #import "MNStepper.h"
  10. @interface MNStepperTableViewCell ()
  11. @end
  12. @implementation MNStepperTableViewCell
  13. #pragma mark - Properties
  14. @synthesize stepper=_stepper;
  15. #pragma mark - Init
  16. + (UITableViewCellStyle)cellStyle
  17. {
  18. return UITableViewCellStyleDefault;
  19. }
  20. - (id)initWithCellIdentifier:(NSString *)cellID
  21. {
  22. self = [super initWithCellIdentifier:cellID];
  23. if (!self) return nil;
  24. self.selectionStyle = UITableViewCellSelectionStyleNone;
  25. self.stepper = [[[MNStepper alloc] initWithFrame:CGRectZero] autorelease];
  26. [self addSubview:self.stepper];
  27. return self;
  28. }
  29. - (void)dealloc
  30. {
  31. MNRelease(_stepper);
  32. [super dealloc];
  33. }
  34. #pragma mark - Layout
  35. - (void)layoutSubviews
  36. {
  37. [super layoutSubviews];
  38. CGRect textFrame = self.textLabel.frame;
  39. textFrame.size.width -=110;
  40. self.textLabel.frame = textFrame;
  41. CGRect stepperFrame = CGRectMake(self.contentView.bounds.size.width - 94, (NSUInteger)(self.contentView.frame.size.height - 70)/2+2, 94, 70);
  42. self.stepper.frame = stepperFrame;
  43. [self.stepper setNeedsLayout];
  44. }
  45. @end