Skip to content

UIToolbar above the keyboard with previous/next/close buttons - #111

Open
neoneye wants to merge 2 commits into
nicklockwood:masterfrom
neoneye:master
Open

UIToolbar above the keyboard with previous/next/close buttons#111
neoneye wants to merge 2 commits into
nicklockwood:masterfrom
neoneye:master

Conversation

@neoneye

@neoneye neoneye commented Jun 1, 2014

Copy link
Copy Markdown

Maybe useful for those of you that needs a toolbar above the keyboard

Simon Strandgaard added 2 commits June 1, 2014 10:24
@TomKremer

Copy link
Copy Markdown

Excellent, please merge this feature, this is important to have.

@kukat

kukat commented Jul 6, 2014

Copy link
Copy Markdown

+1

@nikolaykasyanov

Copy link
Copy Markdown

👍

@aslisabanci

Copy link
Copy Markdown

+1

@nikolaykasyanov

Copy link
Copy Markdown

There are some indentation issues, by the way

@mirceamironenco

Copy link
Copy Markdown

Indeed , this is needed , great addition 👍

@nikolaykasyanov

Copy link
Copy Markdown

@nicklockwood any chance of merging this?

@plandem

plandem commented Aug 16, 2014

Copy link
Copy Markdown
Contributor

Also it would be nice to have an option to set title for toolbar. Here is my current implementation (not at FXForm yet):

https://www.dropbox.com/s/14pmbpl2iiht1wr/Screenshot%202014-08-16%2010.54.14.png

@tomj

tomj commented Oct 13, 2014

Copy link
Copy Markdown

I haven't looked at the code/implementation but this is a great idea IMO

@aslisabanci

Copy link
Copy Markdown

Hi guys with the write access :)
I was wondering if you're thinking of merging this pull request in the near future or not. If not, I'll merge it myself on my local copy, because I'd like to use this.
Can you please let us know about your thoughts on this?

Cheers!

@nicklockwood

Copy link
Copy Markdown
Owner

I'm OK with this idea, but there are a few problems with the implementation that's stopping me from merging it as it stands:

  1. It should be optional - the way this is implemented means that all form fields will get this feature. No Apple forms actually use this toolbar approach - it's used exclusively in web-based forms in Safari, so really it's kind of nonstandard, which means it's not something I would want to force on everyone.

I need to think of a good way to expose an option to enabled/disable this feature. I don't currently have a mechanism for this kind of from-wide configuration, and I want to add it in a way that will scale for other features

  1. This PR declares a couple of private Apple UI constants, for reasons that aren't entirely clear to me. This seems fragile and possibly risks rejection if that gets flagged as private API usage.

@aslisabanci

Copy link
Copy Markdown

I think this pull request can remove the lines

#define APPLE_PRIVATE_API_UIBarButtonSystemItem_Previous ((UIBarButtonSystemItem)105)
#define APPLE_PRIVATE_API_UIBarButtonSystemItem_Next ((UIBarButtonSystemItem)106)

as well and create the next / previous bar buttons in a custom way to eliminate the risk of rejection.

I can understand your concerns in your first comment. Thanks for sharing your thoughts @nicklockwood

@GantMan

GantMan commented Nov 19, 2014

Copy link
Copy Markdown
Contributor

Agreed it should be optional. Seems more and more common that people use this, but it's not for everyone.

looking forward to getting this one merged, so I can use it!

@danielbraun

Copy link
Copy Markdown

I tried to merge this PR into master on my fork, it has some weird conflicts - multiple implementations of functions, access to private variables. Even after I solved it, it doesn't seem to be doing anything.
Perhaps the codebase has changed too much since then.

@GantMan

GantMan commented Nov 24, 2014

Copy link
Copy Markdown
Contributor

@neoneye can you take a glance? Seems like this a heavily requested feature. I know none of us want to manage an aging fork of FXForms.

@danielbraun

Copy link
Copy Markdown

I ended up implementing what I needed myself. I needed a toolbar above each picker with a single "Done" button.
What I did:

  1. Subclass each cell I wanted to modify - I already did this because I RTLed every (right to left - my app is in Hebrew). This is painful if you haven't done it already in your app.
  2. Create a UIToolbar
  3. Set its items to an array of UIBarButtonItems

@neoneye

neoneye commented Nov 24, 2014

Copy link
Copy Markdown
Author

@GantMan sorry, I'm busy with other projects

@anettodev

Copy link
Copy Markdown

There is any way to change the close button title based in a tag(or other attribute) of the field?

@haojianzong

Copy link
Copy Markdown

In addition to @danielbraun's comment, that's what I do to add a done button to a picker view:

  1. Subclass FXFormOptionPickerCell
  2. Override the inputAccessoryView method as following:
- (UIView *)inputAccessoryView
{
    UIToolbar *toolBar= [[UIToolbar alloc] initWithFrame:CGRectMake(0,0,320,44)];
    UIBarButtonItem *barButtonDone = [[UIBarButtonItem alloc] initWithTitle:@"Done"
                                                                      style:UIBarButtonItemStyleBordered target:self action:@selector(doneButtonTapped:)];
    UIBarButtonItem *flex = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
    [toolBar setItems:[NSArray arrayWithObjects:flex, barButtonDone, nil]];
    return toolBar;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.