Tôi cần thêm Góc tròn vào UIImageView
. Tôi tìm thấy một giải pháp từ một diễn đàn, và tôi đã thử đoạn mã sau;Góc tròn UIView hoặc UIImageView
UIImageView * roundedView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"wood.jpg"]];
// Get the Layer of any view
CALayer * l = [roundedView layer];
[l setMasksToBounds:YES];
[l setCornerRadius:10.0];
Tôi đang sử dụng iOS 5, và setMasksToBounds:YES
và setCornerRadius
không được tìm thấy.
Vì vậy, có cách nào khác để tôi có thể nhận các góc tròn trong số UIImageview
không?
Bạn đã thử gán 'l' trở lại thuộc tính lớp' roundView' chưa? – JoePasq
như thế nào? có thể cho tôi thấy nó sẽ trông như thế nào? – Illep
'roundedView.layer = l;' Tôi chưa thử. – JoePasq