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

Reply
 
LinkBack Thread Tools Display Modes
Old 06-20-2011, 04:38 PM   #1 (permalink)
Registered Member
 
Join Date: Mar 2011
Posts: 18
sregorcinimod is on a distinguished road
Default multiple instances of a short when switching between uiviewcontrollers

I have two UIViewcontrollers (A and B) and within UIViewController A i have two "short" variables called C and D, and a method called E.

In the method E it uses D as a counter and loops round until it is the number 3 at which point it loads an image. clicking on the image loads UIViewController B.

When UIViewController B switches back to UIViewController A there are two instances of the shorts, one with the values set in viewDidAppear of UIViewController A (which I want) and one instance holding the values from the first time UIViewController A is used.

I have cheked this by simply putting in an NSLog to show the current value of C and D, the second time UIViewController A is dislayed I get two NSlog messages for each short.

Note: I am switching viewcontrollers by using PresentModalViewController.

Any ideas?
sregorcinimod is offline   Reply With Quote
Old 06-20-2011, 05:07 PM   #2 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

Post code.

modal controllers aren't really a switching mechanism. You present a new controller while the calling controller remains loaded underneath. To go back you don't present the first one again, but dismiss the modal one. In any case, without seeing code we can just guess.
baja_yu is offline   Reply With Quote
Reply

Bookmarks

Tags
short, uiviewcontroller

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: 328
8 members and 320 guests
chemistry, Dnnake, iOS.Lover, lendo, leostc, Leslie80, pbart, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,664
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Leslie80
Powered by vBadvanced CMPS v3.1.0

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