在聊天页子类添加以下方法,具体图片名称请根据自身业务添加
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
//修改文本颜色
[self.unReadMessageLabel setTextColor:[UIColor redColor]];
//修改按钮整体背景图片
[self.unReadButton setBackgroundImage:[UIImage imageNamed:@"这里添加想替换的图片名称"]
forState:UIControlStateNormal];
//修改向上箭头图片
[self.unReadButton.subviews enumerateObjectsUsingBlock:^(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
if ([obj isKindOfClass:[UIImageView class]]) {
UIImageView *imageView = (UIImageView *)obj;
UIImage *image = [UIImage imageNamed:@"这里添加想替换的图片名称"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.width * 0.2, image.size.width * 0.8,
image.size.width * 0.2, image.size.width * 0.2)
resizingMode:UIImageResizingModeStretch];
imageView.image = image;
*stop = YES;
}
}];
}