この吹き出しにはビューを貼りつけられるのでデモのように UILabelで文字情報を表示する他、画像やカスタム描画を実装することもできる。
利用コードはこんな感じ(デモコードより)
-(void)viewDidLoad { [super viewDidLoad]; infoLabel = [[UILabel alloc] initWithFrame:CGRectMake(16, 4, 140, 20)]; infoLabel.font = [UIFont boldSystemFontOfSize:12]; : // [self.infoPanel addSubview:infoLabel] // this will not work, too early to add } -(void)infoPanelWillAppear:(UIScrollView *)scrollView { if (![infoLabel superview]) [self.infoPanel addSubview:infoLabel]; } -(void)infoPanelDidScroll:(UIScrollView *)scrollView atPoint:(CGPoint)point { NSIndexPath * indexPath = [self.tableView indexPathForRowAtPoint:point]; infoLabel.text = [NSString stringWithFormat:@"Something about %d", indexPath.row]; }提供される KNPathTableViewController をサブクラス化して必要なメソッドをオーバーライドして使う。
0 件のコメント:
コメントを投稿