タグ

ブックマーク / tamamemo.hatenablog.com (1)

  • 2012-03-25

    きょうお邪魔したiOS勉強会議 #2にて、 「入れ子になったUIViewも、viewWithTagで親からアクセスできるのか」と疑問が上がったので、その場でためしてみました。 せっかくなのでUP。 UIView* viewA = [[UIView alloc] initWithFrame:self.view.frame]; UIButton* buttonA = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; [viewA setTag:1]; [buttonA setTag:2]; UIView* viewB = [[UIView alloc] initWithFrame:self.view.frame]; UIButton* buttonB = [[UIButton alloc] initWithFrame:CG

    2012-03-25
    foxsafari
    foxsafari 2013/06/13
    tagのデフォルト値は0。setTagしていないself.viewがviewWithTag:0に対応しています。 tagを設定するときは、1以上の整数にするのが望ましい。
  • 1