How to make all the segments of the UISegmentedControl selected on the click of a button? - iphone

I have an application in which I have a segmented control with seven segments in it. I have a button nearby to my segmented control. I want that when I click on my button all my segments of the segmented control should remain selected.

I think this is not possible as it is segmented control. You can create custom buttons and add images as background image to buttons and handle same. This can make you work easy.

A UISegmentedControl isn't meant to work like that, ie to have multiple selections.
It might be possible to override it, but I would recommend instead creating your own custom control, or perhaps create an array of Buttons or Switches.

Related

Using UIPage Control

I have been trying to build a app where you touch three different buttons and then go to there new view. Its it possible to use a UIPage Control? If so How would you go about doing that. For example I have three views. Apple, Orange, Cherry. I would like the user to flick between these three views. I need them to be three separate views i can't just have the image change.
How would I go about using the UIPage Control and switching views?
UIPageControl doesn't deal with switching views itself, it just provides the dots that are typically displayed at the bottom of a paged view and it can be tapped to go one page forward or backward (instead of swiping the actual view). The actual view that displays the content is typically a UIScrollView with pagingEnabled set to YES.
When the control is tapped, it sends the UIControlEventValueChanged event to its target. You'll then have to scroll the UIScrollView to the right page yourself.

How to create a toolbar in a TableView with a Label?

I would like to add a toolbar with a label entitled "Save your search?" on the left and a button "Save" on the right that triggers a specific action when tapped. How could I do that programmatically, especially I want this Toolbar to show up only when a particular View is loaded on a screen but not on every view.
Also, I want the toolbar to have a static image as background. "Save" button will also have a static image for background
Just to check; why do you need to add this toolbar of sorts onto a TableView? Depending on how you've set things up; and specially seeing that you need to conditionally hide/show this toolbar, might be easier to add it outside the tableView (just above it I guess).
Seeing as you need to hide/show this toolbar at will; guess you can simply use a UIView for it and add the UIButtons on top as subviews; --> declare it as a property in the .h file so that it can be freely accessed in the .m file whenever you need to hide / show it.
Did you need help on some specific issue related to this perhaps; or would this serve as a goo enough starting point?

Add extra button to ABPersonViewController

Im working on a small app that displays contact and biography details.
You can see two screenshot here: contactDetails, biogDetails.
At the moment I have an Action button on the right hand side of the NavigationBar that displays an ActionSheet where the user can perform various actions like:
"add to favorites"
"update data",
"Biog Details", etc.
I feel the "Biog Details" is not an action as the others and I would like to display it on a different way.
I was wondering if there is a way to add an extra custom button to the PersonViewController.
I dont really want to create a lookalike of the PersonViewController, because i would lose functionality that I can replicate with the public APIs.
The other option could maybe be to have a segmentedController on the center of the NavigationBar that would switch between the two viewsControllers. How could I do that?
Im open to ideas.
Thanks,
The only way you'll be able to add that extra button is if you use the UIToolBar instead of the UINavigationBar.
If you decide to use the UISegmentedControl you'll also have to use the UIToolBar.
You can duplicate the UISegmentedControl on both views but with the appropriately selected segment on either.
Or you could use one "base" view, add the other two as subviews and hide/unhide the appropriate view depending on the segment that is selected. This would however mean that you change the position of the subviews (by adjusting their rect parameters) so that they appear just below the UIToolBar

iPhone SDK allow touches to affect multiple views

I have a main view that has has two buttons on it that control methods to display the next image and display the previous image. In this case the 'Image' is a class that inherits from UIImageView and has multiple pictures on it that you can interact with, and I call this class a 'Pane'. The pane itself handles all the user interaction itself while the main view controls the display of next and previous panes with the buttons. Here is my dilemma, because the pane fully covers the main view it wont allow for the user to tap the buttons on the main view! So once a pane pops up you cannot change it via the buttons! Is there a way to allow touches through transparent parts of a view, or if not how in the world do I achieve this?!
I cannot pass touchesBegan or any of those methods from the pane to the superview because all of the button touch methods are created in the xib file.
I cannot insert the pane under the control panel because then you wouldn't be able to interact with the pane. And as far as I know theres no way to pass touch events to every single pane within the paneHoldingArray that belongs to the main view
I cannot add the command buttons inside of the pane because I want to be able to replace the command button's image with a thumbprint render of the next/previous pane.
I've been stuck on this for a very long time, please somebody help me out with a fix action or a new way to re-engineer the code so that it will work!
If you want the buttons to capture events, then layer them above the pane. You say you cannot put the control panel above the pane, so break the buttons out into another view that you can put above the pane. If you want the buttons to appear under other views, then make some completely transparent custom buttons to handle you actions that you can layer on top.
I don't know what you mean by the button touch methods are created in the xib file, but in general you cannot effectively pass touch events around. You must organize the view hierarchy so that the views you want to receive events are logically on top. However, nothing says that the views on top have to be opaque or even visible.

Segmented Control to change views

I have created an up/down arrow segmented control button on the right side of the navigation bar in my detail view. In a table based application, how can I use these up/down arrows to move through cells in the parent table?
The apple "NavBar" sample code has an example of this but the controls are not functional.
The iBird program has this functionality as well and it is very nice. Download the "iBird 15" program for free.
Any thoughts?
Thanks!
Set the segmented control to momentary mode, and set the control's action for UIControlEventValueChanged to point to your view controller. Then your view controller can change the selection in the table, or whatever it is you're doing with tables. (I'm not sure if you're using a UITableView or something else.)