How to create radio buttons and drop down menu bar in Swift (for iOS app development)? - ios

I am beginner in iOS app development and am creating an app where I need to create radio button and drop sown menu bar using swift .
Please suggest me, how could I do that ??

Welcome to SO. In general, this site isn't really suited to "show me how to do <development task>" questions. It's intended for specific technical questions about code you are trying to get working.
I'll take pity on you since this is your first post.
Neither radio buttons nor drop-down menus are standard iOS controls. You should consider using iOS standard user interface elements instead.
The iOS equivalent of radio buttons is a segmented control (UISegementedControl)
The iOS equivalent of a drop-down menu is a UIPickerView.
If you really want radio buttons and drop-down menus you could create them yourself, but as a beginner that is likely over your head. You might want to look for open source components that do what you need. Try checking out CocoaControls. There are lots and lots of custom controls. You can likely find what you're looking for there under a reasonable source license like the MIT license.

Related

Embed Menu/PopupMenu or TListItems on a form

Is there any way to embed a TPopupMenu directly on a form, as if it was a panel always open? or maybe just the TMenuItems.
No, it is not possible to embed a menu on a form. The reason is partly that a menu isn't an ordinary window that you can easily manipulate.
So you need to find a different solution. And there are many options you can chose from:
Using a TToolBar:
It doesn't look particularly modern and out of the box you don't get much control over the appearance, though. Also, I don't know exactly how robust this solution is. I stopped using toolbars many years ago.
Using a TCheckListBox:
In this case, I'd recommend you to create a subclass TCheckListBoxEx which toggles an item if you double-click its caption.
Creating a custom control:
This is what I'd do if it is about a central GUI in an important application, because this way you get full control over the appearance and behaviour and can make it really robust. I have done a modern such menu at work, but currently I am at home so I cannot show you it. Here, however, is a menu I made more than ten years ago for a hobby project:
If you don't need the menu to be attached to the form like a control, but only need it not to close when you select an item in it, there are (hacky) ways to achieve that. But that is a different Q.

implement select/cut/paste in TextArea

How can I implement the tradition menu items to copy / cut / paste / selectAll
in Codenameone TextArea
I can do these things if I happen to remember the keystrokes, but I don't
see any hooks to do them programmatically.
Since on-device editing is native the cut/copy/paste work thru touch and the menu will implicitly appear. So normally you wouldn't want to do this programmatically in Codename One, e.g. right now we don't have any API to get the currently selected text either since that concept is pretty different between platforms.
There are Display.copyToClipboard & Display.getPasteDataFromClipboard but those aren't for the text field selection purpose. They are rather for the use case of moving data within/between apps.

Create a drop down select box with dynamic options

I am trying to recreate a popular effect that all iPhone users have seen before on their settings page. Something like when selecting a wireless network. There is normally a title that says "Available Networks" with a blue arrow icon to the right. onClick there is an accordion style slide down effect to reveal the available networks.
I am trying to recreate this to use as a drop down input for my app's settings page since iPhone does not have anything like that in their storyboard builder interface. The other issue is the options will be dynamic (coming from a database).
Has anyone seen a tutorial on this or maybe an open source app I can use as reference.
I am using iOS 6.1 using Storyboards.
EDIT
I should have spent a little more time researching I am sure I would have have this post that was very helpful regardind the actual code for the drop-down not so much the dynamic data. How to create DropDown in xcode?

Trouble with Non-Native Menu in jQuery Mobile

I have a select that I'd like to use the custom menu display (rather than native) in jQuery Mobile. However, I'm just getting strange behavior out of the non-native menu (jsfiddle link). In this case, the non-native menu is only showing one of my three options.
Found the issue right after I posted it. Every option needs a value attribute set (corrected jsFiddle).
Depending on how many options you have, radio buttons groups might be a better option. The problem with any select is that it requires the user to act before ever seeing what their options are. From a user experience perspective, if you don't have a vast amount of options, use radio buttons. This section of a blog post I wrote might help.

How do you create a raised tab bar item, like the one found in Instagram, with Titanium?

I am trying to create a menu like the one on Instragram, with the central item using a special design, but the Titanium Documentation does not provide information about this kind of feature
There's an example with an already answered question in here: How do you create a raised tab bar item, like is found in Instagram? but I need it working on titanium, any clues?
You can mimic that by following these steps;
(This is hackish but the only way for now)
Create the tab group
var tabGroup = Titanium.UI.createTabGroup({
id:"bottomTabs",
bottom:-50
});
Add tabs as much as you need
var tabTimeline = Titanium.UI.createTab({
icon:"icons/btn_timeline#2x.png",
title:"Timeline",
});
Create a button without a title to mimic the raised tab bar like in Instagram.
var btnScan = Titanium.UI.createButton({
backgroundImage:'icons/btn_action.png',
width:46,
height:46,
title:'',
bottom:0
});
Add that button to the tab group.
tabGroup.add(btnScan);
(hope someday titanium supports more low level APIs as well)
I believe Instagram is written in Objective-C. Creating a custom tab bar as they have made involves subclassing the native tab bar, but you don't have the ability to do that with just JS and Titanium.
Here's a tutorial for faking a custom tab bar in Titanium, which involves creating a window with buttons that controls the real tab bar.
http://www.samjordan.co.uk/2011/02/tutorial-custom-iphone-tabbar-using-appcelerator-titanium/
I don't know for which platform Instragram is developed in Titanium but I know about this type of tabs. I have created similar type of tab for one of my project so i can say that this is not built in tab you have to create it at your own.
you have to design icons, backgrounds, raised background and write logic to get this work same as Tab using available UI widgets like views, imageview and labe.
Hope you will be able write logic for this. According to my knowledge this is not built in tab, it's a custom tab.

Resources