0

Possible Duplicate:
Can I show an UISegmentedControl object in vertical?

How to make a UIsegmentController vertical ,I tried using,

segmentedControl.transform = CGAffineTransformMakeRotation(M_PI / 2.0);

but its make the segment control fonts to vertical.Can any one help me to code for vertical segmentcontrolbar?

Community
  • 1
  • 1
iosdev
  • 277
  • 8
  • 19

2 Answers2

0

use this,

NSArray *arr = [segmentedControl subviews];
    for (int i = 0; i < [arr count]; i++) {
    UIView *v = (UIView*) [arr objectAtIndex:i];
    NSArray *subarr = [v subviews];
        for (int j = 0; j < [subarr count]; j++) {
            if ([[subarr objectAtIndex:j] isKindOfClass:[UILabel class]]) {
                UILabel *l = (UILabel*) [subarr objectAtIndex:j];
                l.transform = CGAffineTransformMakeRotation(- M_PI / 2.0);
            }
        }
    }

see Can I show an UISegmentedControl object in vertical?

Community
  • 1
  • 1
Venk
  • 5,949
  • 9
  • 41
  • 52
  • i want to make like this http://stackoverflow.com/questions/9168840/app-store-approval-with-modified-uisegmentedcontrol – iosdev Oct 08 '12 at 07:12
-1

Try this bellow code with some change...

First define Radians on top of the .m file like bellow..

#define degreesToRadians(x) (M_PI * x / 180.0)

and after in viewDidLoad: or viewWillAppear: , try bellow code...

yoursegControl.transform = 
                CGAffineTransformRotate(segControl.transform, degreesToRadians(90));

*Try Dropdawn List,this is give the output like your Requirement *

hey, if you use Dropdawn list insted of this seg control then its also useful to your requirement, see...

http://code.google.com/p/dropdowndemo/downloads/list

:)

Paras Joshi
  • 20,427
  • 11
  • 57
  • 70