1
我有加入到UIToolbar
一個UISegmentedControl
:名稱爲UISegmentedControl選擇的段消失編程
UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:toolbarFrame];
toolbar.barStyle = UIBarStyleBlack;
toolbar.translucent = YES;
toolbar.barTintColor = [UIColor colorWithRed:0.97 green:0.97 blue:0.97 alpha:1.0];
[self.view addSubview:toolbar];
UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithItems:@[@"Last week", @"Last month", @"All time"];
[segmentedControl setSelectedSegmentIndex:0];
[toolbar addSubview:segmentedControl];
工具欄然後被添加到一個視圖控制器。當我拍攝視圖控制器的截圖時,會發生奇怪的事情。所選段的標題消失。
屏幕截圖正在使用採取:
UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, YES, [[UIScreen mainScreen] scale]);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
呈現的視圖:
截圖:
上哪裏開始尋找將理解任何指針。
任何一個想法? drawViewHierarchyInRect:afterScreenUpdates:YES對我們有一些其他的問題... – x2on
'drawViewHierarchyInRect:afterScreenUpdates:'給你造成了什麼問題? –
它有時慢 – x2on