show all tabs with scrolling option (on screen there should be only 4 tabs)

前端 未结 2 1479
误落风尘
误落风尘 2020-12-22 00:59

I am newbie for iOS development. What I have done so far is as below.

  1. Created New Project
  2. Removed all controller and added View Controller.
  3. D
2条回答
  •  半阙折子戏
    2020-12-22 01:54

    You have no code used so far, but you'll absolutely have to do that to achieve this. I'll get you started:

    Create a scrollview at the bottom of your viewcontroller. Create UIViews on it and make them have a width of 640 (iPhone Retina screen width). You can put a image and a title on the UIView and make them function as a button. Set the content size to 640/4 *7 and there you go. You can give the background of the scrollview the same image as the UITabBar, but you'll need this.

    This snippet might help you:

    for (int i = 0; i<7; i++){
        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0 + 50*i,0, 50,50);
        [scrollView addSubview:view];
    }
    

    You'll have to multiply the x origin with the width of the UIViews (plus some margin) to make sure they aren't all on the same spot.

提交回复
热议问题