我有一个iPhone应用程序包含UITableView分组样式。 在我的ViewController定义的UIActivityIndicatorView作为一个属性:UIAableView部分标题中的UIActivityIndicatorView消失方向更改
self.browsingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
browsingIndicator.hidesWhenStopped = YES;
我希望把这个微调的表格标题行之一:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
UIView *sectionHeader = [[[UIView alloc] init] autorelease];
[sectionHeader addSubview:browsingIndicator];
browsingIndicator.center = CGPointMake(20, 30);
return sectionHeader;
}
这是工作。现在的问题是:一旦我改变设备的方向,活动指示灯就会消失,只有当我将其从可见屏幕拖出并重新进入时才会再次出现。将设备转回到原来的方向并没有帮助,将“hidesWhenStopped”更改为“NO都不是。
有人能指出我正确的方向吗?谢谢!
这是因为您正在自动释放标题,这意味着它可能会在将来发布一段时间。当你说“在...之外定义uiview”时,这是有效的,因为你将它保留在某个地方,所以它不会被释放。 – user102008 2011-04-28 04:31:14
Woah ...你和OP都有相同的Identicon O.o – 2016-05-17 20:16:02