Having trouble with GUI design

Discussion in 'iOS Programming' started by DevNull0, Feb 3, 2016.

  1. DevNull0 macrumors 68000

    Joined:
    Jan 6, 2015
    #1
    I'm developing a simple app, and I'm having a lot of trouble creating the GUI. I think I'm missing something fundamental.

    For now, the App should just take two dates as inputs and output the number of days between those dates. I tried using two date picker wheels, and on the iPhone 6s screen size, this works but looks pretty bad. On anything smaller, the UI doesn't fit on the screen. I understand Apple disabled adjusting the size of the date picker, but making them smaller is probably not what i want to do anyway.

    What is the proper way of implementing this?

    Thanks
     
  2. Mascots macrumors 68000

    Mascots

    Joined:
    Sep 5, 2009
    #2
    You can wrap the Date Picker in a View Controller and make "Start" and "End" buttons to present that new VC. This way, the date picker is off the screen unless interaction is being taken by a user and you can reuse that wrapper VC for both selections.

    Personally, I really like Roland Moers' RMDateSelectionViewController, which is a solution if you didn't want to roll your own but still use that method.
     
  3. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #3
    Without seeing the app, I would question why Apple disabled adjusting the size of the date picker. That's very concerning because that mean Apple might drop your app because you have a non-standard date picker size.

    I don't think Apple would disable something without cause. I would think Apple would have a solution to this that fits their rules.

    However, if it's the case that Apple doesn't care what size the date picker is, then could you put it inside another view by itself and shrink the size of that view?

    I remember someone had an issue where he needed to create a holder view to get the resizing he wanted for a number of objects.

    In other words, doesn't the date picker obey the size of the view that it's in?
     
  4. Mascots macrumors 68000

    Mascots

    Joined:
    Sep 5, 2009
    #4
    If you break it apart, it's a pretty complicated component composed of like a hundred of advanced, transforming views, and while it may adjust a little with a bit of messing with it, it's size is pretty much static. It's also a standard UI element, I imagine the current form in a different context may be adverse to the user since it changes touch targets.

    I also thought of this: You could do what Apple does in Settings and embed them in cells in a UITableView or as subviews in a UIScrollView. Then your UI becomes fluid and the pickers are available on screen together.
     
  5. 1458279 Suspended

    1458279

    Joined:
    May 1, 2010
    Location:
    California
    #5
    But if the date picker is inside of another view and that view is scaled to a different size, doesn't it adjust to the size of the view it's in?
     
  6. PhoneyDeveloper macrumors 68040

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #6
    The picker views have always been odd in that they refused to resize. I think Apple had some sample code at one time that showed how to use them.

    The way I've used them in recent apps is to associate the picker with a UITextField as the inputView. When the user taps the text field the picker appears at the bottom of the screen and is as wide as the screen. If you have two textfields and the user taps on the second textfield the picker changes. I've done this in a static tableview. The two UITextFields are in two different rows in the tableview. I haven't done this with date pickers but it should be the same as my own custom pickers.

    You'll never have two pickers on the screen at the same time. Whichever of the textfields is the first responder will show its picker.
     

Share This Page