cocos2dbeginner
cocos2dbeginner

Reputation: 2217

How can I make a vertical UIToolbar?

How can I make a vertical UIToolbar?

Upvotes: 2

Views: 2869

Answers (2)

Arie Litovsky
Arie Litovsky

Reputation: 4993

Subclass UIToolbar and do the following:

CGFloat DegreesToRadian(CGFloat degrees)
{
    return ((M_PI * (degrees))/ 180.0);
}

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) 
    {
        self.transform = CGAffineTransformMakeRotation(DegreesToRadian(90));
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    for (UIView * subView in self.subviews) 
    {
        if(!CGRectEqualToRect(subView.bounds, self.bounds))
            subView.transform = CGAffineTransformMakeRotation(DegreesToRadian(-90));
    }
}

Upvotes: 4

raaz
raaz

Reputation: 12500

Try this

#define M_PI 3.141

UIToolbar *tool;

tool.transform = CGAffineTransformRotate(CGAffineTransformIdentity, 270.0/180*M_PI);

Upvotes: 3

Related Questions