if (cell.accessoryType == UITableViewCellAccessoryCheckmark) {
UIImage *image = [UIImage imageNamed:@"select"];
UIButton * button = [UIButtonbuttonWithType:UIButtonTypeCustom];
CGRect frame =CGRectMake(0.0,0.0,image.size.width,image.size.height);
button.frame = frame;
[button setBackgroundImage:imageforState:UIControlStateNormal];
button.backgroundColor = [UIColor clearColor];
cell.accessoryView = button;
}else
{
cell.accessoryType = UITableViewCellAccessoryNone;
UIButton * button = [UIButtonbuttonWithType:UIButtonTypeCustom];
button.backgroundColor = [UIColor clearColor];
cell.accessoryView = button;
}
[[UINavigationBar appearance] setBackgroundImage:[UIImageimageWithColor:[UIColor whiteColor]]forBarPosition:UIBarPositionAnybarMetrics:UIBarMetricsDefault];
//[[UINavigationBar appearance] setShadowImage:[UIImage new]];
[[UINavigationBar appearance] setShadowImage:[UIImageimageWithColor:RGBA(212, 212, 212,.3)]];
+ (UIImage *)imageWithColor:(UIColor *)color
{
CGRect rect = CGRectMake(0.0f, 0.0f, 1.0f, 1.0f);
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, rect);
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
//修改tabbar黑边颜色
UIImage *img2 = [UIImage initWithColor2:RGB(255, 255, 255) rect:CGRectMake(0, 0, SCREEN_WIDTH, 44)];
UIImage *img = [UIImage initWithColor:RGB(221, 221, 221) rect:CGRectMake(0,0, SCREEN_WIDTH, 0.3)];//.5
[self.tabBar setBackgroundImage:img2];
[self.tabBar setShadowImage:img];
[self.tabBar setBackgroundColor:[UIColor whiteColor]];
[self setStatusBarBackgroundColor:[UIColor whiteColor]];
//设置状态栏颜色
- (void)setStatusBarBackgroundColor:(UIColor *)color {
UIView *statusBar = [[[UIApplication sharedApplication] valueForKey:@"statusBarWindow"] valueForKey:@"statusBar"];
if ([statusBar respondsToSelector:@selector(setBackgroundColor:)]) {
statusBar.backgroundColor = color;
}
}
//如果子视图的范围超出了父视图的边界,那么超出的部分就会被裁剪掉。
[self.avatar setClipsToBounds:YES];
static dispatch_once_t disOnce;
dispatch_once(&disOnce,^ {
//只执行一次的代码
});
//设置组头和组尾部的颜色
-(void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section
{
//YourColor: view.tintColor = WTGayColor(240);
view.tintColor = [UIColor at_whiteColor];
}
-(void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section
{
view.tintColor = [UIColor at_whiteColor];
}