我已經通過線加20子視圖scrollview
線行我們可以從iOS中滾動查看
yPos=0;
for (int i=0; i<24; i++) {
UIView *timeView=[[UIView alloc]initWithFrame:CGRectMake(71, yPos, 909, 60)];
timeView.userInteractionEnabled=TRUE;
timeView.exclusiveTouch=YES;
timeView.tag=i;
NSLog(@"sub vieww tag=:%d",timeView.tag);
timeView.backgroundColor=[UIColor whiteColor];
UILabel *lbltime=[[UILabel alloc]initWithFrame:CGRectMake(0, 0, 70, 60)];
[email protected]"VIEW HERE";
lbltime.textColor=[UIColor grayColor];
// [timeView addSubview:lbltime];
[scrlView addSubview:timeView];
yPos=yPos+61;
}
現在觸摸子視圖屬性時,曾經我在一個子視圖點擊我沒有得到抽頭子視圖屬性。
like coordinates。這是給父視圖座標
我啓用子視圖UserInteractionEnabled
爲是。
任何人可以告訴我如何獲取挖掘子視圖的座標和標籤值嗎?
加點觸手勢與您所添加的意見,並連同基於在tapgetsure事件方法標籤添加標籤的意見,並確定視圖。 –
我建議你編輯帖子以顯示你用來處理水龍頭的代碼。如果你正在使用輕觸手勢識別器,它附加了什麼 - 子視圖或滾動視圖或什麼? – RegularExpression
tapgetsure事件如何獲取挖掘視圖.'UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap :)]; tap.numberOfTapsRequired = 1;如何獲得點擊的視圖。我已經爲每個子視圖設置了標籤 – sudheer