我在UIButton (Add Item Button)
的操作方法中創建了UILabel (lblCount)
和UIButton (btnAdd)
。新的UILabel
和UIButton
被添加到scrollview
。 UILabel (lblCount)
顯示計數UIButton (btnAdd)
點擊。這裏,addBtnClickCount
是一個計數點擊次數的整數。訪問在運行時創建的UILabel
UILabel * lblCount = [[UILabel alloc] initWithFrame:CGRectMake(50, 100*addBtnClickCount, 25, 25)];
lblCount.text = [NSString stringWithFormat:@"%d",count];
lblCount.tag = addBtnClickCount;
lblCount.textColor = [UIColor whiteColor];
lblCount.textAlignment = NSTextAlignmentCenter;
[self.scrollView addSubview:lblCount];
addBtnClickCount = addBtnClickCount+1;
將有多個label (lblCount)
和button (btnAdd)
當用戶點擊Add Item按鈕。我想訪問特定的label
,特別是add button
和display the count
。