0
我一直在爲此苦苦掙扎,並希望任何人都可以闡明爲什麼這不起作用。向TableViewCell添加Popover
我只是試圖在TableViewCell上實現一個Popover。這裏是代碼..
TodoView.m
- (void)tableView:(TUITableView *)tableView didClickRowAtIndexPath:(TUIFastIndexPath *)indexPath withEvent:(NSEvent *)event {
// MyViewController is a TUIViewController with a nib called MyView with just a button in it
MyViewController *t = [[MyViewController alloc] initWithNibName:@"MyView" bundle:nil];
TUIView *theView = [[TUIView alloc] initWithFrame:NSMakeRect(0, 0, 300, 300)];
TUIPopover *myPopover = [[TUIPopover alloc] initWithContentViewController:t];
[myPopover showRelativeToRect:NSMakeRect(0, 0, 300, 300) ofView:theView preferredEdge:NSMaxYEdge];
}
有一段時間,什麼都不會顯示出來。我可以告訴一些事情正在發生,因爲窗口本身會失去焦點,就好像一個Popover 在那裏是。
有時我會看到一個非常小的blip-像2px×2px的小矩形。很難看到它,看起來像屏幕上的壞點,但有時候我會運行這段代碼。
TUIPopover來自Twitter UIKit Framework。
一些可能性...
1)酥料餅不能被看到在CGFillRect?
TodoTableViewCell.m
- (void)drawRect:(CGRect)rect
{
CGRect b = self.bounds;
CGContextRef ctx = TUIGraphicsGetCurrentContext();
CGContextSetRGBFillColor(ctx, 247.0/255, 247.0/255, 247.0/255, 1);
CGContextFillRect(ctx, b);
}
2)酥料餅不適合TableViewCell內,不能被看作
任何人有什麼想法?