-1
我已經滾動視圖的按鈕更多的標籤,我想表現出更多的標籤貼在下面選擇按鈕竊聽和其他按鈕移動到下一個位置 我的我目標C 請任何人能幫助我如何顯示按鈕上滾動視圖網格和拍了拍按鈕顯示在下方
我的代碼是在這裏 的UIScrollView滾動視圖* = [[UIScrollView的頁頭] initWithFrame:方法self.view.frame]。 [self.view addSubview:scrollView];
for (int i = 0; i<83; i++){
imageButton = [UIButton buttonWithType:UIButtonTypeCustom];
[imageButton setTranslatesAutoresizingMaskIntoConstraints:YES];
// [imageButton setBackgroundColor:[UIColor blackColor]];
[imageButton setBackgroundImage:[UIImage imageNamed:@"books"] forState: UIControlStateNormal];
[imageButton setTitle:[NSString stringWithFormat:@" %d",i] forState:UIControlStateNormal];
[imageButton setFrame:CGRectMake(xPossion, yPossion, 70, 60)];
imageButton.highlighted=YES;
[imageButton addTarget:self
action:@selector(butnSelected:)
forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:imageButton];
xPossion += imageButton.frame.size.width+35;
temp++;
if (temp==3) {
yPossion = imageButton.frame.origin.y+imageButton.frame.size.height+20;
temp = 0;
xPossion = 20;
yPossion += imageButton.frame.size.width-15;
[scrollView setContentSize:CGSizeMake(scrollView.frame.size.width ,yPossion-50)];
}
}
我的目標設定爲屏幕象下面enter image description here
,當我點擊一個形象我想顯示的子類別,如下面enter image description here
添加更多的數據你都試過? –
請詳細解釋你的問題。 –
添加你的問題發生的地方的圖像? –