如何制作垂直UIToolbar?
答案 0 :(得分:4)
UIToolbar子类并执行以下操作:
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));
}
}
答案 1 :(得分:2)
试试这个
#define M_PI 3.141
UIToolbar *tool;
tool.transform = CGAffineTransformRotate(CGAffineTransformIdentity, 270.0/180*M_PI);