Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development > iPhone SDK Development - Advanced Discussion

Reply
 
LinkBack Thread Tools Display Modes
Old 12-23-2011, 03:28 PM   #1 (permalink)
justdan
 
Join Date: Jan 2009
Location: Dallas
Posts: 38
justdan0227 is on a distinguished road
Default Best way to implement UIViewControl in multiple Controlers

What is the best way to implement a button that is to be placed in several ViewControllers (part of a UINavigationController app), where when the button is pressed in any of the pushed view controllers the button does the same code of presenting a UIActionSheet to query for a type, and then display a UIImagePicker to pick and image and then return the image to yet another ViewController to save off to a DB.

I want to code the logic behind the button once but use it multiple times in the other view controllers. When I attempted this, the navigation bar would not update with a cancel button once the UIImagePicker was displayed (in the simulator).

Make sense?

Last edited by justdan0227; 12-23-2011 at 06:54 PM.
justdan0227 is offline   Reply With Quote
Old 12-26-2011, 11:56 AM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,002
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by justdan0227 View Post
What is the best way to implement a button that is to be placed in several ViewControllers (part of a UINavigationController app), where when the button is pressed in any of the pushed view controllers the button does the same code of presenting a UIActionSheet to query for a type, and then display a UIImagePicker to pick and image and then return the image to yet another ViewController to save off to a DB.

I want to code the logic behind the button once but use it multiple times in the other view controllers. When I attempted this, the navigation bar would not update with a cancel button once the UIImagePicker was displayed (in the simulator).

Make sense?
How about this:

Create a new category of UIViewController that implements the methods to do what you describe (an IBAction that presents an action sheet, then an image picker, then pushes another view controller, etc.)
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 406
14 members and 392 guests
bignoggins, BSH, djqbert, Duncan C, epaga, flamingliquid, jcdevelopments, leighec68, markolo, mrtdmb, omagod, pinacate, revg, taylor202
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,645
Threads: 94,111
Posts: 402,862
Top Poster: BrianSlick (7,990)
Welcome to our newest member, leighec68
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:01 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0