[iPhone SDK] Several modal views

Hello Professionals,
I have some problems with managing several modal views. So imagine that I have tabBarController with several bars. Then I create another one UIViewController with 2 buttons and display it on top of my tabBarController with help of presentModalViewController method. When I press on one of two buttons I dismiss the first one controller by calling dismissModalViewControllerAnimated and immediately after that create the second controller and display it on the screen (again with help of presentModalViewController). The first controller disappears fine but the second one does not show on the screen at all. tabBarController displays instead of second view controller. What's wrong?
Thanks.

Okay, I've run into this same issue. In my case I'm popping up a modal controller to allow a user to enter authentication credentials and then dismissing the modal controller when they select a "login" button. But, if they enter incorrect information, then I pop up a new authentication modal controller to allow the user to correct their authentication credentials. Unfortunately this happens fast enough that the old controller hasn't dismissed yet (using animated:YES) and the attempt to present the new modal controller fails (I presume that the "pending" dismiss zaps both the old modal controller and the new one I was attempting to present).
So, how does one "wait" for the old modal view controller to finish being dismissed???
Casey

Similar Messages

  • Iphone sdk custom pdf viewer in uiscrollview

    just like in the subject, I am struggling to get pdf view in uiscrollview.
    now, first of all - I know I can do it with UIWebView. I am doing so now, but next version of my app - I need to gain much more control, hence need for doing it like that.
    I hope one day, apple will create example of quartz vector graphics inside uiscrollview.
    now, to the point.
    basicaly got two methods:
    - (void)renderZoomToBitmap
    int w,h;
    NSDate *start;
    NSTimeInterval elapsed;
    start = [NSDate date];
    CGPDFPageRef pageref = CGPDFDocumentGetPage(pdf, _page);
    CGRect mediaBox = CGPDFPageGetBoxRect(pageref, kCGPDFMediaBox);
    mediaBox.size.width *= zoomf;
    mediaBox.size.height *= zoomf;
    w = mediaBox.size.width+0.5;
    h = mediaBox.size.height+0.5;
    CGRect viewBounds=CGRectMake(0,0,w,h);
    char *renderBuff = malloc( w * h * 4 );
    CGContextRef cgContext = CGBitmapContextCreate(renderBuff, w, h, 8, w * 4, CGColorSpaceCreateDeviceRGB(), kCGBitmapByteOrder32Host | kCGImageAlphaNoneSkipLast);
    CGContextSetRGBFillColor(cgContext, 0.1, 0.1, 0.1, 1);
    CGContextFillRect( cgContext, viewBounds );
    CGContextDrawPDFPage(cgContext, pageref);
    CGContextFlush( cgContext );
    renderPage = CGBitmapContextCreateImage(cgContext);
    free(renderBuff);
    CGContextRelease(cgContext);
    elapsed = [start timeIntervalSinceNow] * -1.0;
    // NSLog(@"view bounds past zoom w:%f h:%f", b.size.width, b.size.height);
    self.frame = viewBounds;
    NSLog(@" renderZoomToBitmap zoom:%f took %f s", zoomf, elapsed );
    and one that draws actual bitmap
    - (void)drawRect:(CGRect)rect
    CGContextRef context = UIGraphicsGetCurrentContext();
    NSLog(@"draw rect %f %f %f %f", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
    CGContextTranslateCTM(context, 0.0, rect.size.height);
    CGContextScaleCTM(context, 1, -1);
    CGContextTranslateCTM(context, -_offset.x, _offset.y);
    CGContextDrawImage(context, rect, renderPage);
    [self setNeedsDisplay];
    now everytime
    - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
    is called , I set new zoom scale (zoomf) in above UIView instance, and call first method - to refresh bitmap.
    it does work okay when zoomf=1.0, but when user starts zooming in/out, it does funky things.
    What is the problem , do any one of you fine folks know ? please help me out with this. I am very new to quartz.
    thanks.
    Message was edited by: gryzman

    anyone please?

  • IPhone SDK: auto-rotation sets wrong bounds in view?

    Hi all,
    Can anybody confirm if this is a bug in the iPhone SDK? I have a ViewController that defines as its view a DimensionsLogger, which is a trivial subclass of UIView that just logs its frame, bounds and center properties when layoutSubviews is invoked.
    When I set this view as the root view in my application, the dimensions are logged like so (portrait mode):
    Bounds: (0.000000, 0.000000) x (320.000000, 460.000000)
    I rotate it to landscape mode and the bounds are logged:
    Bounds: (0.000000, 0.000000) x (390.000000, 390.000000)
    Bounds: (0.000000, 0.000000) x (480.000000, 300.000000)
    Then back to portrait mode:
    Bounds: (0.000000, 0.000000) x (390.000000, 390.000000)
    Bounds: (0.000000, 0.000000) x (320.000000, 460.000000)
    So far, so good.
    When I add my DimensionLogger + ViewController to a NavigationController, however, the same process (repeated several times) yields the following output:
    Bounds: (0.000000, 0.000000) x (320.000000, 416.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 346.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 358.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 358.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 346.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 346.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 358.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 358.000000)
    Bounds: (0.000000, 0.000000) x (390.000000, 346.000000)
    The bounds value never returns to the original dimensions.
    Am I missing something, or is this a bug? The practical consequence of this is that it seems impossible to combine the following 3 UI elements:
    - "anchoring" something to the bottom of a view, like a UIToolbar (NOT a tabbar)
    - Nesting that view in a UINavigationController
    - Supporting portrait and landscape interface orientation.
    Also, if I file this as a bug, is there any way to search the bug report tool to see if this has already been filed? I've logged into the tool and I see some search functionality but it only seems to search bugs I've previously filed.
    Thanks,
    Russ

    Just wanted to add that I've tried this in the simulator and on a provisioned iPod touch, same results on both.
    Russ

  • [iPhone SDK] Preference view design/implementation

    Hi, everyone!
    I want to add preference view in my application (build on iPhone SDK 3.0), but don't want to use preference bundle for several reasons.
    And I can't find any suitable UI component to do it (maybe it's UITableView with custom views (with rounded corners)?
    Any thoughts on it?
    Thanks for attention.
    Have a good day

    The rounded corners you see in the system Settings app are produced by a UITableView created with UITableViewStyleGrouped. Each group of cells in a rounded frame is a section of the table view, so you can duplicate a typical Settings page by setting the number of sections and the number of rows per section.
    It looks like you could build most of the cells in Settings by simply adding your own images and/or controls to standard UITableViewCell instances.
    Several of the pages in the UICatalog sample app provide good examples of how to code Grouped style table views with cells similar to some of the Settings cells. That sample code is for 3.0, btw, but almost all of the code is appropriate for 2.x as well.
    If you need help with table views and table view cells in general, see the Table View Programming Guide for iPhone OS.
    For more basic instruction, see Chapter 8 of +Beginning iPhone Development: Exploring the iPhone SDK+ by Mark and LaMarche.

  • How to switch between views in iPhone SDK

    I have been tasked to learn the iPhone SDK. I know Actionscript, Javascript and some Java, but I cannot understand the iPhone SDK at all. I cannot understand the syntax or how the multitude of files work together. Also, there are no tutorials for complete beginners that show step-by-step what to do and why.
    All I am trying to make is an application with a couple of views that change when the user touches a button. What is the easiest way to switch from one view to another?
    Also, what is an AppDelegate? What is "synthesize"? What is "nonatomic,retain"? Why can't I write code like this... theButton.onClick=loadView("NewView");

    Ok, you really need to read up some on how Objective-C and Cocoa work.
    That said, If you make a new project in XCode using the "Utility" template, you can immediately run it and see a view transition (flip).
    Ultimately, however, what you're looking to do is way beyond what you should be expecting to be to be able to do at this point. Programming a scripting language (Javascript, ActionScript) is much different than programming in C/C+/Objective-C/Objective-C+. While not directly applicable to the iPhone, you'll probably want to buy and read Aaron Hillegass' book "Cocoa Programming for Mac OX X 3rd Edition".
    There is a tutorial on the iPhone Dev Center (log in, main page, bottom right, under "resource types", click "Guides", and look for "iPhone Application Tutorial" on the next page) that is worth reading.
    rob.

  • How do I pop-up a media player modal view in iPhone app?

    Hi,
    I would love to know how the mail app in the iphone pops up a media player modal view when you click on an audio attachment in an email. The media player view slides up, plays the file, then slides away, giving control back to the mail app. Does anyone know how this is done?
    Thanks!

    It also matters not where the media files are stored (laptop hard drive or network drive).
    AppleTV relies on iTunes to stream local content.
    Not the most environmentally friendly option but that's the way it is.
    AC

  • IPhone SDK UISegmentedControl and hiding view

    Hello,
    Im slowly getting to grips with the iPhone SDK but having a problem today, I have a UISegmentedControl setup to a toggleSetting function but this toggleSetting calls a url in the background for some data, but this freezes my application while the web request is taking place, this can take around 2 seconds and so I made another view (loadingView) with a loading screen thats animated and I want to show this whis the connection is taking place and then hide it again once complete.
    I don't have any problems with showing or hiding the view until the web request happens.
    When my app loads I call \[loadingView setHidde:YES] which hides my view straightaway, then my toggleSettings method is below, but this does not cause the view to show while the quest is taking place, I think it is showing an hiding it instantly as if I just ask to show it, it will show but only after the web call is complete. Anyone got any pointers???
    <code>
    -(IBAction)toggleSetting:(id)sender
    [loadingView setHidden:NO];
    UISegmentedControl *segmentedControl = (UISegmentedControl *)sender;
    NSInteger segment = segmentedControl.selectedSegmentIndex;
    if(segment==0) {
    NSURL *url = [NSURL URLWithString:@"http://myurl"];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [NSURLConnection sendSynchronousRequest: request returningResponse: nil error: nil ];
    [loadingView setHidden:YES];
    </code>

    I don't have code handy but take a look at the class reference for NSURLConnection and related calls.
    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self startImmediately:YES]; would be a good start.
    You want to use a call that will create some callbacks to update you when a connection is confirms, how many bytes are transfered, etc. so be sure to write the call functions.

  • [iPhone] Can I display two modal view controllers after each other?

    Hi,
    This is for BETA 7.
    Here is a simplified version of my problem.
    In my application root view controller , the user presses a 'Start Wizard' button and they get modal view controller A presented which contains a 'Step 1 Complete' button. When that 'Step 1 Complete' button is pressed , ModalVC A dismisses itself and delegates an "I'm done" event to the root view controller , which presents another ModalVC B to the user with a 'Step 2 complete'. So basically imagine a Wizard of Modal View Controllers. Try to make one, it doesn't work.
    The problem is that MODALVC B doesn't get displayed. It almost seems that when ModalVC A dismisses itself from the parent , this does not go in effect until the main thread goes back into its message loop for a redraw or something and it ignores the subsequent 'PresentModalViewController : nextcontroller' call.
    The only way to make it work is to have 2 buttons ('Do Step 1' and 'Do Step 2') is the root view controller and have the user press them individually. Of course that's not what I want.
    Message was edited by: Maxm007

    Yes , most of my application uses the navigation bar. The problem is that the two modal views involved are are used separately throughout the application quite frequently. In this specific case I want to reuse them , but consecutively.
    If I do choose to go for a navigation bar for this case , then I'd need to have two versions of these two views , one without and one with my custom toolbar , wouldn't I?
    I'll definitely try the queued posting. Do I use NSNotification center or is there another way to asynchronously post an event?

  • IPhone SDK Calendar View Control/Tool??

    I guess I was expecting something in the iPhone SDK toolkit to display a full calendar (as in the iPhone calendar application) rather than just a date picker.
    Does anyone know of any Cocoa code that displays calendars like in the iPhone Calendar application that could be used with the iPhone SDK?
    Thanks.

    I did not say it was "difficult", it was just not as easy as it might seem. Our programmer cranked out the core class in a few days, but testing revealed the periodic quirks as I mentioned. So, I would encourage you to continue.
    I am reluctant to tell you my app as I am sick of the trash talk and complaining about the pricing and do not want to read any more on this discussion group. The calendar looks almost exactly like Apple's but without the animation on month changes or fast month changing (and there are no appointment functionality).
    With no disrespect to you or Shanghai, the buildings are works of art, the people are friendly, but the air quality is terrible and my son hates to take a breath there.

  • IPhone SDK 2.2 memory corruption

    Hello. I'm working on an application for iPhone SDK 2.2 and seem to be having weird memory corruption problems. Not necessarily leaks because using Instruments shows my memory stamp never going above about 1.8 megs. The nature of the app is a database of animals so I'm constantly loading and unloading sounds and images. None of the objects are very large (at most I'll have 4 800k pngs loaded at once) and I've checked and rechecked my alloc/retain/release and everything is in order (hence no memory usage increase). However...after using the application for a while I'll notice strange behavior. For example:
    1) we have a UILabel as the title for each page. After a while the font size of this will change.
    2) I have several screens with a subclassed UIScrollView where images are loaded and then added to. The problem shows itself here by the images not showing up. there's no crash, stepping through the debugger shows that the image loads up fine, it's just that the image is not there.
    3) I have a UILabel at the top of an animal description screen, which in the nib file is called "Animal Name" by default. This will change to show "Animal Name" at the top.
    I've removed all audio in our latest build so that isn't the problem. What I'm starting to suspect is that altering anything defined in a nib file will cause corruption. For example, the UIScrollView is defined in the nib file, and I constantly am reassigning the contents of that with a UIImageView. This UIImageView is handled within the subview class like :
    UIImageView *imgView = [[UIImageView alloc] initWithImage: [ UIImage imageWithContentsOfFile:[[NSBundle mainBundle ] pathForResource:imageToLoad ofType:@"png" ]] ];
    imgView.tag = 50;
    [self addSubview:imgView ];
    [ imgView release ];
    Then later when moving away from the screen I'll find that view's tag and remove it from the superview (since addSubView increases the retain count, the alloc+addSubView is cancelled by release+removeFromSuperView)
    I can't explain why titles that are never changed would be affected, but it must somehow be related. What I'm wondering is: are there any known issues involving modification of the contents of objects defined in Nib files? Perhaps the memory allocated when initWithNibName is restrained, then any modification of objects allocated within it can cause corruption. I'm starting to think I should just alloc and free anything modified in code and skip using nib files altogether (I reset the text on buttons for example). If this is a known issue please let me know. I'll give you more information if I can.
    Thank you

    Just download the huge SDK package and install. No need to uninstall the old SDK.

  • Troubleshooting iPhone SDK build 9M2199 beta 7 ...

    I successfully installed the iPhone SDK last night but seem to have a few problems: a) the DOC SET for the "Apple iPhone OS 2.0" does not seem to work, retried several times.
    b) when trying to follow the "Getting started" tutorial I noticed that the install did not install a "Cocoa Touch template" in the New Project.
    I did try to re-install the same thing again but still no luck.

    I am glad I am not the only one here! I kept on thinking the installation must have gone wrong somewhere.
    The probable new names I think are:
    Cocoa Touch OpenGL Application -> OpenGL ES Application
    Cocoa Touch Tab Bar -> Tab Bar Application
    Cocoa Touch Utility -> Utility Application
    The unclear ones:
    Cocoa Touch Application -> ?
    Cocoa Touch List -> ?
    ? -> Navigation-Based Application
    ? -> View-Based Application
    ? -> Window-Based Application
    Does anyone know when the tutorials are updated to what the SDK actually looks like?
    Message was edited by: BelAus

  • IPhone SDK - What is the equivalent of a combo box

    I have a screen where there are quite a few items which are of the multiple-choice type. In other platforms i use a combo box (pick lists) to do this.
    On the iPhone SDK the only thing that comes close is the UIPicketView which is ugly IMHO. it takes too much real estate and too heavy.
    Is this is the only control available now?
    Also does the UIPicker come with an associated control which will launch the picker? What i mean is on other platforms and on the web there is a text field with a button with a down arrow next to it. Clicking either on the text field or the down arrow drops the list down. Is there a similar control on the iPhone which when clicked launches the picker OR do i have to create a button or a custom view which will launch the picker?
    Thanks for reading this and for your feedback.
    -TRS

    I do not believe there is an equivalent of -D in the DB JVM, a possible solution is:
    Load a properties file into the DB using Loadjava, then open this file from your Java code using Properties.load(), then iterate the properties calling System.setProperty().
    Chris

  • Learning iPhone SDK - Trying to draw an image

    Although I have programmed for Mac in the last years, I have never used Mac-specific technologies as Cocoa (I have programmed more in OpenGL, SDL, and the like).
    Now I am getting started with the iPhone SDK. I'd like to do some OpenGL|ES stuff, but since it is not supported in the Simulator, and you need to join the Developer Program to test stuff on directly on the device (and admission of new members is closed right now), I am focused on other stuff right now, like using Core Graphics for drawing images on the iPhone.
    My application is based on the Cocoa Touch Application template. I left the default code except for a few changes.
    In file "UntitledAppDelegate.m", I have changed the method applicationDidFinishLaunching to:
    - (void)applicationDidFinishLaunching:(UIApplication *)application {
    window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
    contentView = [[[MyView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
    [window addSubview:contentView];
    [window makeKeyAndVisible];
    Then, in the MyView interface file (MyView.h), I have added the attribute "UIImageView* image;" to the class, which is declared as a property, and synthesized.
    In the class implementation (MyView.m), I have changed the method initWithFrame to:
    - (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
    self.backgroundColor = [UIColor darkGrayColor];
    image = [self loadImageView:@"box01.png"];
    [self addSubview:image];
    return self;
    loadImageView is a private method I have implemented as:
    - (UIImageView *)loadImageView:(NSString *) imageName {
    UIImage *img = [UIImage imageNamed:imageName];
    UIImageView *theView = [[UIImageView alloc] initWithImage:img];
    return theView;
    Since I have loaded the UIImage, and initialized a UIImageView with it, and the image view is added as a subview of the main view attached to the window, I thought it should be everything needed to draw an image on the screen. But nothing is visible. The screen is simply black when I run this on the Simulator. It doesn't even set the background to dark gray.
    So I need some help with this, I sure that anyone with experience in Mac programming will know how to help me.
    Thank you in advance.
    Message was edited by: Jedive

    I removed the XIB file from the project, but that didn't help. It was a problem with my inexperience with Objective-C. When accessing class properties in a method of the same class, i was not putting "self." before the property (in C++ that's redundant). For example, in the line "window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];". After adding it, it works correctly.

  • IPhone SDK : Communication between iPhone client and a remote server

    Hi,
    This is w.r.t iPhone Cocoa Touch native application.
    i need to populate my application 's data from a remote application server ( which in turn connects to the database) . I require some tips in the communication between client sitting on the iPhone and the remote application server. I am planning to proceed in XML transaction way.
    I referred the SeismicXML sample application provided by Apple. In this sample,client reads the physically existing xml file from @"http://earthquake.usgs.gov/eqcenter/catalogs/eqs7day-M2.5.xml"; and the client parses the xml file and display the content on the table view.
    i have following 2 queries ,
    1. I do not want to read from a physically present file,i want the data to be transferred on the go.
    Means, request should be sent from the client to a application server and the server process returns the data in form of xml file ( but its not creating any physical xml file) .
    Basically i am looking for request - response concept.
    2. Can we call a java process(which returns xml data) running on a remote server from the cocoa touch client.? If not java process,what would be other best way...
    i am going through the Apple provided frameworks. Do any of the iPhone SDK frameworks support this request? If some one has any idea on the above mentioned queries, pls help me.
    any pointers will also be helpful.
    It might be too early to talk about these,but i have to take some business decision related on this.
    thanks in advance.

    You already know how to send a string via HTTP Post? And you know how to make XML into a string? Put the two together.

  • IB 3.1 iPhone SDK - UITableViewController?

    When you drag an instance of UITableViewController out of the IB Library in the iPhone SDK, you get a view with a tableView in it.
    Now if you have an existing window and other objects in that window, including a tableView (that you are trying to add a controller for), how are you supposed to do it?
    Usually, controller objects in IB just appear at the top-level in your nib file and have properties to connect them to the view object (a tableView) and the model object (the content).
    What is this new thing where it opens a view with a tableView in it already?
    Anybody know? Do I have to start the whole window with this view and add other objects to it? It's not even in the window - it doesn't even have its own window.

    iPhone Dev Center
    Downloads
    Read me before downloading
    If you have updated your device to iPhone OS 3.1.3 with iTunes, you must install iPhone SDK 3.1.3 in order to continue with your development.
    *iPhone SDK 3.1.3*
    iPhone SDK 3.1.3 includes the Xcode IDE, iPhone simulator, and a suite of additional tools for developing applications for iPhone and iPod touch.
    _Posted: February 2, 2010_
    Leopard Build: 9M2809a
    Snow Leopard Build: 10M2003a
    *Leopard Downloads*
    iPhone SDK 3.1.3 with Xcode 3.1.4
    iPhone SDK 3.1.3 with Xcode 3.1.4 Readme
    *Snow Leopard Downloads*
    iPhone SDK 3.1.3 with Xcode 3.2.1
    iPhone SDK 3.1.3 with Xcode 3.2.1 Readme
    *Other Downloads*
    iPhone SDK Agreement
    iPhone Configuration Utility

Maybe you are looking for

  • Airplay no longer working with 3rd party after upgrading to Maverick.

    I updated my MacBook Pro this week and I have noticed that the airplay icon is no longer showing up in iTunes to connect to my Denon Amplifier. The interesting thing is that my old iPad 1 that I have that is still running 5.1.1 can connect and play t

  • Acrobat Reader 9.5.0 has Clipboard problems

    Repro: Launch Microsoft Word 2010. Launch Adobe Reader one any Web document. Switch to Microsoft Word and Copy some text onto the clipboard. And quickly switch back to Adobe Reader and copy some text from there.     "There was an error while copying

  • Connecting IPod to computer causes computer to shut off

    This has never happened before. I plugged my IPod into the same USB port I always do for the first time since downloading the latest ITunes update and my computer shut off. Anything else I plug into the USB port works fine, it is only a problem with

  • Using multiple img src / with htmlText --display problem

    I need help. I am using multiple <img src /> tag with htmlText and pictures displays in layers(overlay)? html_txt.html = true; html_txt.htmlText = "text<br><img src = ' http://picture1.jpg 'width='500' height='491' hspace='0' /><br>more text<br><img

  • Oracle e-Business Employee Reconciliaton Error

    Hi, I am tring to run a trusted recon using the following connector:Oracle e-Business Employee Reconciliation. I have create a custom query where I have the following conditions in the WHERE clause: AND ( (ROUND((PAPF.LAST_UPDATE_DATE -TO_DATE('01011