Skip to content
Browse files

fixing segmented control when running on iPad

  • Loading branch information...
1 parent ada4837 commit 3d70e3b2d633974bb58885795f9307cea23015b8 @escoz escoz committed May 14, 2012
Showing with 13 additions and 2 deletions.
  1. +4 −2 quickdialog/QSegmentedElement.m
  2. +9 −0 sample/Localizable.strings
View
6 quickdialog/QSegmentedElement.m
@@ -27,7 +27,6 @@ - (QSegmentedElement *)init {
return self;
}
-
- (void)handleSegmentedControlValueChanged:(id)control {
_selected = ((UISegmentedControl *)control).selectedSegmentIndex;
[self handleElementSelected:_controller];
@@ -40,9 +39,12 @@ - (UITableViewCell *)getCellForTableView:(QuickDialogTableView *)tableView contr
cell.backgroundColor = [UIColor clearColor];
UISegmentedControl *control = [[UISegmentedControl alloc] initWithItems:_items];
[control addTarget:self action:@selector(handleSegmentedControlValueChanged:) forControlEvents:UIControlEventValueChanged];
- control.frame = CGRectMake(9, 0, 302, 46);
+ const BOOL isPhone = [UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPhone;
+ control.frame = CGRectMake(isPhone ? 9 : 30, 0, isPhone ? 302 : 260, 46);
+ control.autoresizingMask = UIViewAutoresizingFlexibleWidth;
control.segmentedControlStyle = UISegmentedControlStyleBar;
control.selectedSegmentIndex = _selected;
+ control.tag = 4321;
[cell addSubview:control];
return cell;
View
9 sample/Localizable.strings
@@ -7,3 +7,12 @@
"Done" = "Done";
+
+"Metric %li" = "Metric %li";
+"REVENUE" = "REVENUE";
+"TRANSACTIONS" = "TRANSACTIONS";
+"CONVERSION RATE" = "CONVERSION RATE";
+"GOALS VALUE" = "GOALS VALUE";
+"GOALS TOTAL" = "GOALS TOTAL";
+"NEW VISITS" = "NEW VISITS";
+"TAP AND HOLD\nto change the metric" = "TAP AND HOLD\nto change the metric";

0 comments on commit 3d70e3b

Please sign in to comment.
Something went wrong with that request. Please try again.