4

load and unload a message

 3 years ago
source link: https://www.codesd.com/item/load-and-unload-a-message.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

load and unload a message

advertisements

I create a message when a process starts (BOOL YES) and I am trying to make it go away when it ends (BOOL NO), debugging shows me stepping through the whole function both in the beginning and end, however the message is still there.

Where am I going wrong? Thank you in advance

-(void) loadStillLoadingMessage:(BOOL)yesNo{
CGRect screenBound = [[UIScreen mainScreen] bounds];
CGSize screenSize = screenBound.size;
CGFloat screenWidth = screenSize.width;
CGFloat screenHeight = screenSize.height;
UILabel *loading = [[[UILabel alloc]initWithFrame:CGRectMake((screenWidth/2)-75,(screenHeight)-140,300,40)]autorelease];

loading.text = @"still loading";
loading.backgroundColor = [UIColor clearColor];
loading.textColor = [UIColor blueColor];
loadingLabel = loading;
[self.view addSubview:loadingLabel];
[loadingLabel setHidden:YES];
if (yesNo == YES) {
    [loadingLabel setHidden:NO];
}else if (yesNo ==NO){
    [loadingLabel setHidden:YES];
}


This method is creating a UIView whenever it is called. So the UIView you create and show on the first time is different to the UIView you create, show and then hide the second time. You need to look at instance variables (declaring a variable in the header file).


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK