Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10780] iOS: Activity Indicator for AlertDialog

GitHub Issuen/a
TypeNew Feature
PriorityMedium
StatusClosed
ResolutionWon't Fix
Resolution Date2014-02-24T22:24:57.000+0000
Affected Version/sRelease 3.0.0
Fix Version/s2014 Sprint 04, 2014 Sprint 04 API
ComponentsiOS
Labelsapi, supportTeam
ReporterHidayet Dogan
AssigneeIngo Muschenetz
Created2012-08-16T02:29:14.000+0000
Updated2017-03-29T17:47:35.000+0000

Description

It would be nice to have an option to show activity indicator on AlertDialog view. For example: !http://mobiledevelopertips.com/wp-content/uploads/2010/02/alert3-204x300.png! AlertDialog can be "showIndicator" option or something like that.
var dialog = Ti.UI.createAlertDialog({
    title: 'Loading...',
    message: 'Please wait, loading assets.',
    showIndicator: true
});

Comments

  1. Hidayet Dogan 2012-09-05

    I'm waiting PR found at https://github.com/appcelerator/titanium_mobile/pull/2789 for issue TIMOB-10507. I may use new "style" property instead of "showIndicator" property, if it's accepted and merged.
  2. Vasco Borges 2012-11-20

    I've been able to do this by editing TiUIAlertDialogProxy.m on the Titanium SDK and adding the following code, just after {color:blue}[alert show]{color}.
     
       BOOL showIndicator = [TiUtils boolValue:[self valueForKey:@"showIndicator"] def:NO];
       if(showIndicator==YES){
          UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
               
          // Adjust the indicator so it is up a few pixels from the bottom of the alert
          indicator.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 45);
          [indicator startAnimating];
          [alert addSubview:indicator];
          [indicator release];
       }
       
    Then I just set the property {color:blue}showIndicator{color} to {color:blue}true{color}. In order to remove the default button I set the property {color:blue}buttonNames{color} to an empty array {color:blue}[ ]{color}.
  3. Viktor Korol 2013-04-04

    Please implement solution from Vasco Borges.
  4. Alexey Chulochnikov 2013-04-25

    Please implement solution from Vasco Borges.
  5. Hidayet Dogan 2013-04-25

    That implementation is currently crashes application. Tested on iOS 6 SDK with Titanium SDK 3. I'll try to fix implement if I find a spare time.
  6. Vasco Borges 2013-04-26

    Works with Titanium SDK v2.x. Tested on iOS v4, v5, v6.
  7. Vishal Duggal 2014-02-24

    While Android allows customization of the Ti.UI.AlertDialog element via the androidView property, the options on iOS are pretty limited. iOS explicitly forbids subclassing the UIAlertView element or changing the view hierarchy, so the solution proposed above is a non starter. See https://developer.apple.com/library/ios/documentation/uikit/reference/UIAlertView_Class/UIAlertView/UIAlertView.html, https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/UIKitUICatalog/UIAlertView.html#//apple_ref/doc/uid/TP40012857-UIAlertView That being said, you can always fake the look and feel of a UIAlertView using regular Ti.UI.View with rounded borders on iOS. This of course would mean that the other UI elements on the screen would be inter-actable and it would not behave as a true alert view. To overcome this you could stick your custom view inside a transparent Ti.UI.Window on iOS and open this window. In this case you should be prepared for the blur and focus events of your top Ti.UI.Window when the window with the fake alert view is opened and closed. Either ways we will not be implementing this in our SDK as the workarounds can be implemented in JS.
  8. Lee Morris 2017-03-29

    Closing ticket as "Won't Fix", with reference to the above comments.

JSON Source