Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Unable to show or hide Titanium Views from Custom iOS Module

$
0
0

Application Type: Mobile

Titanium SDK: 3.2.3

Platform: iOS 7.1.x

Device: iPad Simulator

Host OS: OS X 10.9.3

Description:-

I have implemented a Custom iOS Module in my project, which allows users to view and edit PDF Files. When the user tries to read a document, I am loading the Module View, returned by this Module inside a View in my Titanium's View File (XML File).

I have a Save Button in my Module View. When the user taps on this, I want to show an Activity Indicator.

Below is, Titanium Code to add, show and hide the Activity Indicator

var style;
 
if (Ti.Platform.name === 'iPhone OS'){
  style = Ti.UI.iPhone.ActivityIndicatorStyle.BIG;
} else {
  style = Ti.UI.ActivityIndicatorStyle.BIG;
}
 
var activityIndicator = Ti.UI.createActivityIndicator({
    style: style,
    height: Ti.UI.SIZE,
    width: Ti.UI.SIZE
});
 
var backgroundView = Titanium.UI.createView({
   width:"100%",
   height:"100%",
   backgroundColor: "#000",
   opacity: 0.5,
   zIndex: 10
});
 
$.readerWin.add(backgroundView);
backgroundView.add(activityIndicator);
 
/*
** This function shows the Background View
*/
function showloader() {
    Ti.API.info("reader.js showloader");
    backgroundView.show();
    activityIndicator.show();
}
 
/*
** This function hides the Background View
*/
function hideloader() {
    Ti.API.info("reader.js hideloader");
    activityIndicator.hide();
    backgroundView.hide();
}

Below is, iOS Methods to Invoke a Callback function in my Titanium Code

- (void)invokeShowLoaderCallback
{
    // showLoaderCallback is KrollCallback for "showloader()"
    [self _fireEventToListener:@"show" withObject:nil listener:showLoaderCallback thisObject:nil];
}
 
- (void)invokeHideLoaderCallback
{
    // showLoaderCallback is KrollCallback for "hideloader()"
    [self _fireEventToListener:@"hide" withObject:nil listener:hideLoaderCallback thisObject:nil];
}
Question:-

When I try to invoke "showloader()" or "hideloader()" functions from the iOS Module, I am able to see the Ti.API.info() statements being printed in my Logs, but the Activity Indicator is not showing. Is there anything wrong in my code? or is there a different way to implement such a scenario.

Thanks, Nirumal.


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>