0
我有一个形象,我需要瓷砖作为一个UIView背景:ColorWithPatternImage和约束
UIView *buttonView = [UIView new];
[buttonView setTranslatesAutoresizingMaskIntoConstraints:NO];
[buttonView addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[buttonBar(100)]" options:0 metrics:nil views:NSDictionaryOfVariableBindings(buttonView)]];
[buttonView setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bottomBar-bg-100.png"]]];
的图像是200×200,但我需要的是100。如果我添加图像:
imageView.image = [UIImage imageWithName:@"bottomBar-bg-100.png"]
它会压缩到100.但是,当我使用colorWithPatternImage:
方法时,它不会将200高的图像压缩到100高。
是否有一些愚蠢与colorWithPatternImage:
和使用约束,或者只是如何colorWithPatternImage:
工作?
不,我不知道。谢谢,我会研究它。 – Padin215
我写了一本教你的书:http://www.apeth.com/iOSBook/ch15.html#_uiimage_and_uiimageview – matt