2010-10-13 8 views

Odpowiedz

20

pięść zaimportować plik

#import <QuartzCore/QuartzCore.h> 

a następnie ustawić właściwość widoku tekstowym

yourTextViewName.layer.cornerRadius = kCornerRadius; 

gdzie kCornerRadius jest stałym ustawieniu, jak promień na rogu

+0

dzięki kolego , .... pracował .. :) –

+0

dzięki to pomaga –

+0

Mam Wystąpił błąd "użycie niezadeklarowanego identyfikatora kCornerRadius" –

5

Spróbuj go będzie działać na pewno

musisz importować

QuartzCore/QuartzCore.h 


UITextView* txtView = [[UITextView alloc] initWithFrame:CGRectMake(50, 50, 300, 100)]; 
txtView.layer.cornerRadius = 5.0; 
txtView.clipsToBounds = YES; 
1

definiuję klasę kategoria dla UITextView w ncurses.h:

@interface UITextView (RoundedCorner) 
-(void) roundedCornerDefault; 
-(void) roundedCornerWithRadius:(CGFloat) radius 
       borderColor:(CGColorRef) color 
       borderWidth:(CGFloat) width; 
@end 

a klasa realizacja:

#import <QuartzCore/QuartzCore.h> 
#import "UITextView+RoundedCorner.h" 

@implementation UITextView (RoundedCorner) 

-(void) roundedCornerDefault { 
    [self roundedCornerWithRadius:10 
         borderColor:[[UIColor grayColor] CGColor] 
         borderWidth:1]; 
} 

-(void) roundedCornerWithRadius:(CGFloat) radius 
        borderColor:(CGColorRef) color 
        borderWidth:(CGFloat) width { 
    self.layer.cornerRadius = radius; 
self.layer.borderColor = color; 
self.layer.borderWidth = width; 
self.clipsToBounds = YES; 
} 
@end 

Przykład użycia:

#import "UITextView+RoundedCorner.h" 
... 
[self.myTextView roundedCornerDefault]; 
+0

To pytanie zostało opublikowane od dawna .. :) –

Powiązane problemy