Reputation: 2217
How can I make a vertical UIToolbar?
Upvotes: 2
Views: 2869
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
Reputation: 12500
Try this
#define M_PI 3.141
UIToolbar *tool;
tool.transform = CGAffineTransformRotate(CGAffineTransformIdentity, 270.0/180*M_PI);
Upvotes: 3