UISearchBar

All of mine actually go into a “master” project and I pull out each class for the individual projects when I post them. So its actually not that hard to separate out the classes @Richard Berglund. Like Ulrich I have never used Github, only downloaded projects from it, but I might try to learn how if I have a bunch of free time.

Is there any way to interface XOJO iOS code with SWIFT code?

If you mean like is possible in Xcode with objective-c then as far as I know the answer is no. You can always use declares though.

What do you mean by two lines of text? Like this:

This is a long option | that takes up two lines |
or something like this?

First Option | Second option

The second is already possible with the UIPicker (link to project) I posted in another thread, and the first should be possible if I add one of the datasource methods to it, although it would require some experimental declares since Xojo doesn’t support the creation of arbitrary views and view controllers (think container controls for iOS).

I would be very cautious at this stage of Xojo iOS, in getting too dependent on using declares to activate what hopefully will become standard available controls and functions… Personally I am very disappointed that the available palette is so sparse

but in Swift/Objc multi-line picker items (in a real UIPickerView) do not seem to be an option.

I tried adding "
" into the text, and the picker just truncated it at that point

[quote=156634:@Dave S]but in Swift/Objc multi-line picker items (in a real UIPickerView) do not seem to be an option.

I tried adding "
" into the text, and the picker just truncated it at that point[/quote]
You would have to feed it a custom UIView in the “pickerView:viewForRow:forComponent:reusingView:” delegate method I believe, then add a multiline label to that view to get the multiline effect. This is certainly difficult in Xojo at this point, although probably possible with a little bit of work.

It is extremely simple.

  • Sign up for free at github.com
  • Create a repository
  • Create a local repository on your disk (a folder)
  • Save in Xojo project format

Download the Github software. When you have changed something in the local folder, the app will show you what has been changed and offer to synchronize. Put a comment in the update and click commit, then synchronize. That’s it.

I did not know much about Github, until I tried. It is extremely easy.

[quote=156634:@Dave S]I would be very cautious at this stage of Xojo iOS, in getting too dependent on using declares to activate what hopefully will become standard available controls and functions… Personally I am very disappointed that the available palette is so sparse

but in Swift/Objc multi-line picker items (in a real UIPickerView) do not seem to be an option.

I tried adding "
" into the text, and the picker just truncated it at that point[/quote]

The UIPicker is intrinsically not different from a Mac OS X or Windows menu. Ever since the first Mac and Visi-On or 1984 Windows, I have never seen a two line per item menu. What Christoph is proposing is so alien, I frankly do not see where he could have got that strangest of ideas.

But UIPickerView has a numberOfRowsinComponent property, and UILabel (which can be part of UIPickerView) knows a numberOfLines property :smiley:

[quote=156631:@Jason King]What do you mean by two lines of text? Like this:

This is a long option |
that takes up two lines |[/quote]

Yes two lines - one above and one below. This is for sure possible. :slight_smile:

NumberofRowsinComponent is simply how many items (rows) are in a Component (wheel) of the picker

What is being suggested is that a given item(row) be able to show multiple lines,
I don’t think this is as each row is a single string (which tests show truncate at “newline”)
so you would have to over-ride just about everything, at which point I would suggest a whole custom subclass instaead

Christoph… just saw your post… I would love to know how you think this can be done

I have custom subclasses for almost all the UIKIT controls for a Swift project, and I have found no “easy” way to do this

but here is an objc link… ton of extra code, and it didn’t seem to work quite like the poster wanted

http://stackoverflow.com/questions/20510969/uipickerview-multi-line-rows-need-layout-advice

It may be possible. Anything is doable with enough intent. I even think it is already doable with a fairly nice picker appearance by messing around in a table tableCellData image. Which may very well be available in the picker as well.

But am sorry, since the infancy of personal computing I have seen for myself, a menu never had more than one line per possible choice. Even in very verbose language of Marcel Proust French. Whenever there were more, a submenu would be used.

Because something is possible does not mean it should be done. I think it is a terrible idea, and a picker with two lines per cell would look like a mess.

[quote=156638:@Michel Bujardet]Sign up for free at github.com
Create a repository
Create a local repository on your disk (a folder)
Save in Xojo project format[/quote]
What sounds so easy in theory becomes hard to master in reality: I did evyerthing so, but my commits won’t appear, the GitHub app gives me cryptic errors, and it either cannot find the cloudy or the internal repository. :frowning:
EDIT: And when I tell Xojo to save as text format, it saves binary instead ?!?!?

Unless I am mistaken, the UIPicker will call the delegate method “pickerView:viewForRow:forComponent:reusingView:” which would allow you to supply your own UIView to be used in the UIPicker. Using that view it should be possible to add a multiline label, although I agree with Michel that this is unexpected behavior.

I did see the default UIPickerView with two lines in a lot of iOS apps. Mostly one with large font and one line with smaller font.
Probably not easy to do but it seems to be possible. :slight_smile:

I also saw several iOS apps using the PickerView having only one line but depending on the amount of characters, the font size was changed so the text line is always visible no matter how long the text file is.
For UITextField this is possible with the following declare.

declare sub setAdjustsFontSizeToFitWidth lib "Foundation" selector "setAdjustsFontSizeToFitWidth:" (obj as ptr,value as Boolean) setAdjustsFontSizeToFitWidth(ptr(me.Handle),true)

Would be cool if this can be added to the UIPickerView. :slight_smile:

Great. I wouldn’t expect less from you ! :slight_smile:

[quote=156647:@Ulrich Bogun]What sounds so easy in theory becomes hard to master in reality: I did evyerthing so, but my commits won’t appear, the GitHub app gives me cryptic errors, and it either cannot find the cloudy or the internal repository. :frowning:
EDIT: And when I tell Xojo to save as text format, it saves binary instead ?!?!?[/quote]

OK. I just checked that a repository can use binary projects. You can see it works at https://github.com/Mitchboo/test where I put both a zip and a binary project.

Here is step by step the way to do it with the GitHub app :

  1. Create the local repository on your Mac
  2. Put your binary project, image folders and stuff into it
  3. In GitHub app, go File/Create New Repository
  4. In the box that appears, click Add on top
  5. Chose the local folder where your project files are
  6. Click Create and Add Repository
  7. This creates the repository and shows the files to sync.
  8. Enter a comment under “Uncommitted changes” (necessary whenever you sync)
  9. Go menu Repository/Publish
  10. Give it the web name (for instance Test) and click “Publish Repository” in the lower right
  11. Click “Commit and sync”
  12. Right click the repository in the left pane of the Github app, and select “View on Github”

All these steps are only necessary once, when you create the repository. Afterward, whenever you add or modify files, you will get offered to publish and sync.

Note that the file README.md contains the description of the repository on the github page, and it should be in the files.

[quote=156652:@Christoph De Vocht]I did see the default UIPickerView with two lines in a lot of iOS apps. Mostly one with large font and one line with smaller font.
Probably not easy to do but it seems to be possible. :slight_smile:

I also saw several iOS apps using the PickerView having only one line but depending on the amount of characters, the font size was changed so the text line is always visible no matter how long the text file is.
For UITextField this is possible with the following declare.

declare sub setAdjustsFontSizeToFitWidth lib "Foundation" selector "setAdjustsFontSizeToFitWidth:" (obj as ptr,value as Boolean) setAdjustsFontSizeToFitWidth(ptr(me.Handle),true)

Would be cool if this can be added to the UIPickerView. :)[/quote]
I almost have it working properly. I made it work leaking memory and now I am filling the leak. Will post a new project in a bit. My problem right now is that Auto only supports 1D array conversion and I need 2D array conversion :frowning:

Here is the new project. The class has a new name (PickerViewMultiline) which allows for, as the name implies, multiline content in the PickerView. You don’t need to do anything special, simply make the Text that you assign longer when adding columns. If you aren’t going to need multiline content I would recommend that you stick with the original since it will use less memory (significantly less if you have more than about 25 multiline options since each option has an iOSTextArea associated with it internally) and because the multiline just doesn’t look natural to me. That could of course be because I have never seen a multiline UIPicker before now.