iOS应用程式的有效UI造型[已关闭]

我的问题是一个简单的问题.在 android中,我们可以将xml样式表从布局中分离出来,以便可以随时重用,并轻松地编辑UI设计更改.

是否也可能在iOS xcode?如果可以如何(喜欢不是从控制器)?需要图书馆?什么是好的图书馆?

谢谢您的回答.

解决方法

您可以为此目的使用 UICategory类的UIView类.为设置边框,边框颜色,通过路径,拐角半径等创建不同的方法.这只是他们中的少数.类别是UIView,所以你可以使用按钮,lables,textview,textedits等;

UIView category.h

@interface UIView (category)
-(void)maketoRoundEdgeWithBorder:(CGFloat )borderwidth bordecolor:(UIColor *)color;

@end

UIView类别

@implementation UIView (category)

-(void)maketoRoundEdgeWithBorder:(CGFloat )borderwidth bordecolor:(UIColor *)color
{
   NSLog(@"height %f width %f",CGRectGetHeight(self.frame),CGRectGetWidth(self.frame));
    self.layer.cornerRadius=CGRectGetHeight(self.frame)/2;
    self.layer.masksToBounds=YES;
    self.layer.borderColor=[color CGColor];
    self.layer.borderWidth=borderwidth;
}

@end

用它

[yourlable maketoRoundEdgeWithBorder:0.0f bordercolor:[UIColor clearColor] cornerRadius:8.0f];

[yourbutton maketoRoundEdgeWithBorder:0.0f bordercolor:[UIColor clearColor] cornerRadius:8.0f];

[yourTextview maketoRoundEdgeWithBorder:0.0f bordercolor:[UIColor clearColor] cornerRadius:8.0f];

[yourTextfield maketoRoundEdgeWithBorder:0.0f bordercolor:[UIColor clearColor] cornerRadius:8.0f];

相关文章

UITabBarController 是 iOS 中用于管理和显示选项卡界面的一...
UITableView的重用机制避免了频繁创建和销毁单元格的开销,使...
Objective-C中,类的实例变量(instance variables)和属性(...
从内存管理的角度来看,block可以作为方法的传入参数是因为b...
WKWebView 是 iOS 开发中用于显示网页内容的组件,它是在 iO...
OC中常用的多线程编程技术: 1. NSThread NSThread是Objecti...