mirror of
https://github.com/arichornlover/uYouEnhanced.git
synced 2026-04-21 07:41:59 +00:00
Update AppIconOptionsController.m
This commit is contained in:
parent
5c84140877
commit
cfb8ed01f1
1 changed files with 16 additions and 21 deletions
|
|
@ -46,8 +46,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray<NSString *> *)sortedAppIcons {
|
||||||
|
return [self.appIcons sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||||
return self.appIcons.count + 1;
|
return self.appIcons.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
|
@ -59,28 +63,19 @@
|
||||||
if (!cell) {
|
if (!cell) {
|
||||||
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
|
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Cell"];
|
||||||
}
|
}
|
||||||
|
NSArray<NSString *> *sortedIcons = [self sortedAppIcons];
|
||||||
|
NSString *iconPath = self.appIcons[indexPath.row];
|
||||||
|
cell.textLabel.text = [iconPath.lastPathComponent stringByDeletingPathExtension];
|
||||||
|
|
||||||
if (indexPath.row == 0) {
|
UIImage *iconImage = [UIImage imageWithContentsOfFile:iconPath];
|
||||||
cell.textLabel.text = @"Reset";
|
cell.imageView.image = [self resizedImageWithImage:iconImage];
|
||||||
if (indexPath.row == self.defaultIconIndex) {
|
cell.imageView.layer.cornerRadius = 10.0;
|
||||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
cell.imageView.clipsToBounds = YES;
|
||||||
} else {
|
|
||||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
NSString *iconPath = self.appIcons[indexPath.row - 1];
|
|
||||||
cell.textLabel.text = [iconPath.lastPathComponent stringByDeletingPathExtension];
|
|
||||||
|
|
||||||
UIImage *iconImage = [UIImage imageWithContentsOfFile:iconPath];
|
|
||||||
cell.imageView.image = [self resizedImageWithImage:iconImage];
|
|
||||||
cell.imageView.layer.cornerRadius = 10.0;
|
|
||||||
cell.imageView.clipsToBounds = YES;
|
|
||||||
|
|
||||||
if (indexPath.row - 1 == self.selectedIconIndex) {
|
if (indexPath.row == self.selectedIconIndex) {
|
||||||
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
cell.accessoryType = UITableViewCellAccessoryCheckmark;
|
||||||
} else {
|
} else {
|
||||||
cell.accessoryType = UITableViewCellAccessoryNone;
|
cell.accessoryType = UITableViewCellAccessoryNone;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cell;
|
return cell;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue