forked from mirrors/linphone-iphone
Improve UACellBackgroundView
This commit is contained in:
parent
8ac20a0cb9
commit
357849ecc1
3 changed files with 20 additions and 7 deletions
|
|
@ -170,7 +170,8 @@ static void sync_address_book (ABAddressBookRef addressBook, CFDictionaryRef inf
|
|||
UIContactCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId];
|
||||
if (cell == nil) {
|
||||
cell = [[[UIContactCell alloc] initWithIdentifier:kCellId] autorelease];
|
||||
// Background View
|
||||
|
||||
// Background View
|
||||
UACellBackgroundView *selectedBackgroundView = [[[UACellBackgroundView alloc] initWithFrame:CGRectZero] autorelease];
|
||||
cell.selectedBackgroundView = selectedBackgroundView;
|
||||
[selectedBackgroundView setBackgroundColor:LINPHONE_TABLE_CELL_BACKGROUND_COLOR];
|
||||
|
|
|
|||
|
|
@ -19,12 +19,11 @@ typedef enum {
|
|||
} UACellBackgroundViewPosition;
|
||||
|
||||
@interface UACellBackgroundView : UIView {
|
||||
UACellBackgroundViewPosition position;
|
||||
BOOL automaticPositioning;
|
||||
}
|
||||
|
||||
@property(nonatomic) UACellBackgroundViewPosition position;
|
||||
@property(nonatomic, copy) UIColor *backgroundColor;
|
||||
@property(nonatomic, copy) UIColor *backgroundColor;
|
||||
@property(nonatomic, copy) UIColor *borderColor;
|
||||
@property(assign) BOOL automaticPositioning;
|
||||
|
||||
@end
|
||||
|
|
|
|||
|
|
@ -17,10 +17,14 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWi
|
|||
|
||||
@synthesize position;
|
||||
@synthesize backgroundColor;
|
||||
@synthesize borderColor;
|
||||
@synthesize automaticPositioning;
|
||||
|
||||
- (void)initUACellBackgroundView {
|
||||
[super setBackgroundColor:[UIColor clearColor]];
|
||||
backgroundColor = nil;
|
||||
[self setBackgroundColor:[UIColor colorWithRed:0.02 green:0.549 blue:0.961 alpha:1.0]];
|
||||
borderColor = nil;
|
||||
[self setBorderColor:[UIColor grayColor]];
|
||||
automaticPositioning = TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +60,16 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWi
|
|||
if(backgroundColor != nil) {
|
||||
[backgroundColor release];
|
||||
}
|
||||
backgroundColor = [[UIColor alloc]initWithCGColor:abackgroundColor.CGColor];
|
||||
backgroundColor = [[UIColor alloc] initWithCGColor:abackgroundColor.CGColor];
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
- (void)setBorderColor:(UIColor *)aborderColor {
|
||||
if(borderColor != nil) {
|
||||
[borderColor release];
|
||||
}
|
||||
|
||||
borderColor = [[UIColor alloc] initWithCGColor:aborderColor.CGColor];
|
||||
[self setNeedsDisplay];
|
||||
}
|
||||
|
||||
|
|
@ -123,7 +136,7 @@ static void addRoundedRectToPath(CGContextRef context, CGRect rect, float ovalWi
|
|||
CGGradientRef myGradient = nil;
|
||||
const CGFloat *default_components = CGColorGetComponents([[self backgroundColor] CGColor]);
|
||||
CGFloat components[8] = {default_components[0], default_components[1], default_components[2], default_components[3], default_components[0] * 0.766f, default_components[1] * 0.766f, default_components[2] * 0.766f, default_components[3]};
|
||||
CGContextSetStrokeColorWithColor(c, [[UIColor grayColor] CGColor]);
|
||||
CGContextSetStrokeColorWithColor(c, [borderColor CGColor]);
|
||||
CGContextSetLineWidth(c, lineWidth);
|
||||
CGContextSetAllowsAntialiasing(c, YES);
|
||||
CGContextSetShouldAntialias(c, YES);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue