我想你可以在選擇器下打印子視圖並修改它們。 數據第一次加載後,UIPickerView創建子視圖。 With performSelecter:WithObject:afterDelay :,你可以刪除它們或插入任何你需要的東西。
- (void)viewDidLoad
{
[super viewDidLoad];
[self refreshClock];
[timePicker_ performSelector:@selector(leakSelf) withObject:nil afterDelay:0];
[self performSelector:@selector(setupTimePicker) withObject:nil afterDelay:0];
}
- (void)setupTimePicker {
[[timePicker_ subviewOfClass:NSClassFromString(@"_UIPickerViewTopFrame")] removeFromSuperview];
CGRect frame = timePicker_.frame;
frame.size.width += 20;
frame.origin.x -= 10;
timePicker_.frame = frame;
}
@implementation UIView(UIViewDebugTool)
- (void)leakSubview:(UIView*)subroot atDepth:(NSUInteger)dep {
DLog(@"trace sub view[%u] %@", dep, [subroot description]);
CALayer* layer = subroot.layer;
for(CALayer* l in layer.sublayers) {
DLog(@"layer[%u] %@", dep, l);
}
for(UIView* v in subroot.subviews) {
[self leakSubview:v atDepth:dep+1];
}
}
- (void)leakSelf {
NSUInteger dep = 0;
[self leakSubview: self atDepth:dep];
}
@end
我已經在我的項目來實現這一點,我怎麼能實現它相當好文章? – 2016-12-20 07:15:59
當我在尋找解決方案時,沒有直接的方法來實現它。我能夠說服設計團隊改變它的外觀和感覺。 – 2017-01-10 08:34:32