p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional iPhone and iPad Database Application Programming (http://p2p.wrox.com/forumdisplay.php?f=603)
-   -   Chapter 3 - long proces by 500 entries - alertView (http://p2p.wrox.com/showthread.php?t=86975)

IandiPhone March 15th, 2012 09:29 AM

Chapter 3 - long proces by 500 entries - alertView
 
Dear Bob, I need your help again. I press a button and then get the table view to see. Now I have over 200 entries with different graphics. This takes on an iPhone 3G for about 3 seconds. I would like to distribute the user with a showAlertx and UIActivityIndicatorView time. Unfortunately this is impossible. Can you help me please?

Thank you very much, Michael

Here is my code:

[self showAlert];

-(void)showAlert{

alert = [[[UIAlertView alloc] initWithTitle:@"Please Wait..." message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
[alert show];

UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicator ViewStyleWhiteLarge];

indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);

[indicator startAnimating];

[alert addSubview:indicator];

[indicator release];

}

-(void)dismissAlert{

[alert dismissWithClickedButtonIndex:0 animated:YES];
[alert release];

}

thepianoguy March 16th, 2012 08:33 AM

I don't think using an alertView is the right way to display the activity indicator, and with the way you have it set up there is no way to manually dismiss the alertView since it has no buttons. I assume that you intend to dismiss it programmatically when the tableView has finished loading. I would create a view to overlay on the tableView with the text and activity indicator and add it when the tableView is loading, dismissing it when the loading is complete.

Second, since your alertView is autoreleased, it should not be released again in your -dismissAlert method.

Checkout
http://fromideatoapp.com/blueprint-homepage/
Download the Part 4: Custom Animations Demo and see how the "Countdown" tab approaches the situation. Is this similar to what you are trying to achieve?

Bob

IandiPhone March 17th, 2012 12:25 PM

Hi Bob,
many thanks for your expert answer.
The reference to "Custom Animation Demo" is very interesting. My problem is I think that (synchronous?) Simultaneous display of the activity indicators and the loading of tableView. The view will remain for about 3 seconds to stand around the tableView is displayed, and this time I would like to display an activity indicator.
Unfortunately I do not get us anywhere.

Thank you very much, Michael

thepianoguy March 18th, 2012 08:07 AM

The project I referred you to is more about creating a "look" for an overlay to your tableView when presenting your activity indicator, since I think the UIAlertView is not what should be used.
Concerning the calling and dismissing of the activity indicator, is your tableView already on the screen and reloading, or is it making its initial appearance? We will need to determine what delegate methods or notifications can be used to summon and then dismiss the overlay.

Bob

IandiPhone March 18th, 2012 08:26 AM

Hi Bob,

tableView is the first time charged from a subView and is it making its initial appearance.

- (TestTableViewController *)testTableViewController {

// [self showAlert];

// Instantiate the view controller if necessary.
if (rednerTableViewController == nil) {
testTableViewController = [[TestTableViewController alloc] initWithNibName:@"TestThemaListeView" bundle:nil];
}
return testTableViewController;
}

Have a nice sunday, Michaael.

thepianoguy March 19th, 2012 12:22 PM

I have done an example project that I believe accomplishes what you want. One version with an overlay and one with an alertView.
Send an email to
ipadhelper@me.com
and I will reply with the project.

Bob

IandiPhone March 19th, 2012 12:43 PM

Dear Bob,

I've sent you an e-mail.

Thank you.
Best regards, Michael

IandiPhone March 21st, 2012 12:37 PM

Dear Bob,

that was exactly what I needed.

Thank you for that.

Michael


All times are GMT -4. The time now is 11:26 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.