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.

Similar Messages

  • [iPhone SDK] Actions after showing view

    In my iPhone application I am switching views by clicking a button. But when I switch views, my application waits until the new view is done with loading. This is not what I want.
    I want my application to switch views and show the new view. After the view is shown I want to do the loading of my text/images/etc.
    I can't seem to find out what I need to do, to accomplish this.
    Is there some event that gets triggered after a view is completly visible?
    My view is a UIViewController.
    Message was edited by: Wim Haanstra

    I have had similar problems and have not been able to find any answers to this. I am calling addSubView in an action method. After the addSubView is called, I remove the previous view and then start doing some processing. However, it seems that it will not display the view until the whole method has finished processing. If I comment out the last couple lines of processing, it loads right away. I have also tried putting the processing code in the viewDidDisappear method but that also didn't work (it waited until I finished executing that method before it displayed my new view).
    Anyone have any suggestions out there?

  • [iPhone SDK] OpenGL and gDrawElements

    Trying to learn OpenGL at the same time I'm learning the iPhone SDK
    I made a simple cube and was trying to display it on the iPhone, what I get is just a unrecognizable blob on the screen. Any suggestions on what I'm doing wrong? thanks.
    glTexCoordPointer(2, GL_FLOAT, 8 * sizeof(GL_FLOAT), Box_vertex);
    glNormalPointer(GL_FLOAT, 8 * sizeof(GL_FLOAT), Box_vertex + 2);
    glVertexPointer(3, GL_FLOAT, 8 * sizeof(GL_FLOAT), Box_vertex + 5);
    glEnableClientState(GLTEXTURE_COORDARRAY);
    glEnableClientState(GLNORMALARRAY);
    glEnableClientState(GLVERTEXARRAY);
    glDrawElements(GLTRIANGLES,Box_polygoncount*3,GL_UNSIGNED_SHORT,Boxindex);
    float Boxvertex[Boxvertexcount][8]={
    {0.00000, 1.00000, 0.00000, 0.00000, 1.00000, -0.50000, -0.50000, 0.50000},
    {0.00000, 0.00000, 0.00000, 0.00000, 1.00000, -0.50000, 0.50000, 0.50000},
    {1.00000, 0.00000, 0.00000, 0.00000, 1.00000, 0.50000, 0.50000, 0.50000},
    {1.00000, 1.00000, 0.00000, 0.00000, 1.00000, 0.50000, -0.50000, 0.50000},
    {0.00000, 1.00000, 0.00000, 0.00000, -1.00000, 0.50000, -0.50000, -0.50000},
    {0.00000, 0.00000, 0.00000, 0.00000, -1.00000, 0.50000, 0.50000, -0.50000},
    {1.00000, 0.00000, 0.00000, 0.00000, -1.00000, -0.50000, 0.50000, -0.50000},
    {1.00000, 1.00000, 0.00000, 0.00000, -1.00000, -0.50000, -0.50000, -0.50000},
    {0.00000, 1.00000, -1.00000, 0.00000, 0.00000, -0.50000, -0.50000, -0.50000},
    {0.00000, 0.00000, -1.00000, 0.00000, 0.00000, -0.50000, 0.50000, -0.50000},
    {1.00000, 0.00000, -1.00000, 0.00000, 0.00000, -0.50000, 0.50000, 0.50000},
    {1.00000, 1.00000, -1.00000, 0.00000, 0.00000, -0.50000, -0.50000, 0.50000},
    {0.00000, 1.00000, 1.00000, 0.00000, 0.00000, 0.50000, -0.50000, 0.50000},
    {0.00000, 0.00000, 1.00000, 0.00000, 0.00000, 0.50000, 0.50000, 0.50000},
    {1.00000, 0.00000, 1.00000, 0.00000, 0.00000, 0.50000, 0.50000, -0.50000},
    {1.00000, 1.00000, 1.00000, 0.00000, 0.00000, 0.50000, -0.50000, -0.50000},
    {0.00000, 1.00000, 0.00000, 1.00000, 0.00000, -0.50000, 0.50000, 0.50000},
    {0.00000, 0.00000, 0.00000, 1.00000, 0.00000, -0.50000, 0.50000, -0.50000},
    {1.00000, 0.00000, 0.00000, 1.00000, 0.00000, 0.50000, 0.50000, -0.50000},
    {1.00000, 1.00000, 0.00000, 1.00000, 0.00000, 0.50000, 0.50000, 0.50000},
    {0.00000, 1.00000, 0.00000, -1.00000, 0.00000, -0.50000, -0.50000, -0.50000},
    {0.00000, 0.00000, 0.00000, -1.00000, 0.00000, -0.50000, -0.50000, 0.50000},
    {1.00000, 0.00000, 0.00000, -1.00000, 0.00000, 0.50000, -0.50000, 0.50000},
    {1.00000, 1.00000, 0.00000, -1.00000, 0.00000, 0.50000, -0.50000, -0.50000},
    int Boxindex[Boxpolygoncount][3]={
    {0, 1, 2},
    {2, 3, 0},
    {4, 5, 6},
    {6, 7, 4},
    {8, 9, 10},
    {10, 11, 8},
    {12, 13, 14},
    {14, 15, 12},
    {16, 17, 18},
    {18, 19, 16},
    {20, 21, 22},
    {22, 23, 20},
    };

    Thanks for the reply. i did try that suggestion, but the cube still isn't rendering to anything even remotely resembling a cube. I was pretty sure I did a sizeof(GLUNSIGNEDSHORT) and got 4 on NSLog, but I could be wrong. I exported this data out of Cheetah 3D. Perhaps there is a better program for exporting 3d data for iphone? I'm at a loss for what else could be wrong. Probably I am missing one gl comand or parameter, I just can't figure out what it is.

  • IPhone SDK Beta and Unix Tools

    Does anyone know how to compile Unix tools for the iPhone with the SDK? All I seem to be able to find is, "install the toolchain". That doesn't help.
    Specifically, I'd like to compile ettercap-ng. I know ettercap has ARM sources and even an ARM .deb in the apt-get repo (for debian). Given all that, it shouldn't be hard to do.
    I've already got some dev tools on my actual iPhone, and I can use a terminal emulator to issue the compile and make commands.
    I'm trying to compile ettercap-NG 0.7.3, and every time I do, (cd /{ettercap source here} && ./configure) I get:
    checking whether make sets $(MAKE)... (cached) yes
    checking how to run the C preprocessor... /lib/cpp
    configure: error: C preprocessor "/lib/cpp" fails sanity check
    See `config.log' for more details.
    Seeing as that's as far as I seem to be able to get on the actual handset, does anyone know how to use the SDK on a MacBook (Leopard 10.5.3 so on and so forth) to do it, and then transfer it over?

    Mark, You have to be a registered iPhone developer to have the beta level firmware that allows direct access to the iPhone via the SDK. As far as accessing the BSD file structures the only way AFAIK thats currently possible is to hack the phone. And of course we cannot discuss that on this forum....
    Try over here: http://www.appstoredeveloper.com/forum/index.php?sid=fdd5a5f29c264bd57440ba989ee 4b054
    or here: http://www.modmyifone.com/forums/iphone-ipod-touch-sdk-development-discussion/

  • IPhone SDK 6 : Bug with VIew controller Autorotation ?

    Since i installed the Beta 6, the views that used to work fine now dont size properly after the orientation has been changed. For e.g. when i change the orientation the size of the view changes to 560 x 240. It should have been 480 x 320.
    I should note here that i am not using the IB. I code my views and view controllers.
    Am i missing something? Has anyone noticed a similar behavior?
    Thanks.
    -TRS

    The issue is with UINavigationController navigationBarHidden property being set to YES. The view sizes properly after rotation if this property is set to NO which is the default.
    This issue may be fixed in Beta 7 but i have not had a chance to verify it. Will test and post my results here.
    I have filed a bug after an apple engineer at WWDC confirmed it is a bug.
    -TRS

  • 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

  • Cannot use AddressBook Framework for iphone SDK

    I am trying to use the AddressBook Framework with iPhone SDK, and I added the following framework to my xcode project:
    /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/System/Lib rary/Frameworks/AddressBook.framework
    When I compile, references to classes such as ABAddressBook and ABPerson cannot be resolved. ('ABPerson undeclared ...'). However, It seems the C interface to AddressBook is defined.
    I am using the framework in the iPhone SDK directory, and I have #import <AddressBook/AddressBook.h> in my header file, but it is not working for me. Any tips would be appreciated.

    It does explain the OP's problems
    Conserning add and checking if there are changed records in the addressbook I hear people complain about it and got refered to apple to report it as a bug for the sdk.
    And since we still are limited when it comes to mentioning the api I will rather link something someone else wrote on the topic before.
    Have a look here: http://forums.macrumors.com/showthread.php?p=5495200 that should give you some of the basics.

  • Iphone sdk iTunes

    I am a bit new to this forum so I hope not to commit any major faux pas' in this post:
    I am just reading the iPhone sdk documents, and trying to wrap my head around the possibilities.
    I am trying to figure out if there is a way to access the music that the user has on their device. Is it possible to read that XML from a users iTunes directly, or somehow interact with the file system to find all of their music?
    Thanks for any and all guidance. Much will be appreciated and returned.

    Same question. Is there any way to ask the user to select a song that's on the iPhone?

  • 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.

  • 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.

  • View iPhone on desktop and play apps?

    Is it possible to view your iPhone on the Mac desktop and play your apps etc. I realise this requires multi-touch and wouldn't work properly but it would be a handy way to check some of your apps out without without having to go through the phone looking for them.

    Is it possible to view your iPhone on the Mac desktop
    No.
    play your apps
    iPhone applications can't be used on a Mac outside of the emulator bundled with the iPhone SDK, and can't be used on a PC at all.
    (51386)

  • 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.

  • TS3988 I use iCloud. I have an iPhone, Apple laptop, and I recently bought an iPad. The pictures I take on my phone can be viewed on my iPad, but what about all the pictures on my phone that I took before I bought my iPad? How do I view those with my iPad

    I use iCloud. I have an iPhone, Apple laptop, and I recently bought an iPad. I can view the pictures I take on my cell phone on my iPad. But what about all the pictures I took on my phone before I bought my iPad? How do I view those on my iPad?

    POP: yahoo, aol, comcast/time warnder/road runner
    Imap: google, hotmail, and more including icloud.
    If you want to use multiple devices - move to imap, I would even say "exchange", but Google does not support free exchange anymore, since January of that year. So Ironically  Icloud or Hotmail would be my choices right now.
    To find out more about what happens to you, search on Google "difference between pop and imap"

  • Why cant I rotate and save a picture from iphone 4s in windows photo viewer windows 7? the error is cannot save because there is a problem with the photo properties. I can rotate and save screenshots

    why cant i rotate and save a picture from iphone 4s in windows photo viewer windows 7? the error is cannot save because there is a problem with the photo properties. I can rotate and save screenshots

    Windows do not repect the digital EXIF specification. Use a free viewer http://www.irfanview.net/ for Windows.

Maybe you are looking for

  • Goods Receipt / Goods Issue / Transfer Posting

    Hi Scenario: A pack contains 6 materials of same type but of 3 different colors viz Red:2; Yellow:2; White:2. I purchase this pack and sell the same pack. If sales of this pack is not not much, then i do a Goods Issue to a Cost Center. And then i wan

  • How to password-protected an external disk on yosemite?

    I search for hours but with no results... I'm searching for a simple and free application that will password protect my external disk I'm moving from one place to another one. There are a lot of free solutions for PC but I have a hard time finding a

  • Why can't I change me email address?

    Went to adujust some settings in iCloud on the new iPad and went into my accounts setting, and on my info page it gives me my apple id/password/etc. Yet at the bottom in advanced settings i mis-wrote my email and now my mails won't sync with iCloud.

  • Screen flicker on GX740

    Hey When i plug in the power cord, the screen flickers once. If i just let it stand idle in my browser, it flickers continously.. When i start a game, e.g WOW, during the loading progress the screen flickers through the entire process, when the game

  • Cf  MX to cf 5

    Hie there, I need a solution for my prob. Currently we used cf MX for our application(which is for internal access) and cf 5 for external access. There's a lot changes to make if we want to use same application for 2 diff version of CF. For a few rea