开发者

refreshing UIView in iphone app

开发者 https://www.devze.com 2023-02-18 09:38 出处:网络
hii every one , in my iphone application am downloading a image(jpg) file from FTP & loading that to the footer of every screen,& am placing following code in viewDidLoad to assign the file t

hii every one ,

in my iphone application am downloading a image(jpg) file from FTP & loading that to the footer of every screen,& am placing following code in viewDidLoad to assign the file to image variable

documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"XML"];
  开发者_开发问答 documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"Extras"];
   imgLogo.image = [UIImage imageWithContentsOfFile:[documentsDirectory stringByAppendingPathComponent:@"logo.jpg"]];

but image is not displaying when we open the screen for first time it will be loaded after reopening the same screen 2 ,3 times,,so i need to refresh the view ,,,how can i do that?? can any one help me,,,,thanx in advance


Did u try

[myView setNeedsDisplay];

Quote from Apple docs:

By default, geometry changes to a view automatically redisplays the view without needing to invoke the drawRect: method. Therefore, you need to request that a view redraw only when the data or state used for drawing a view changes.In this case, send the view the setNeedsDisplay message. Any UIView objects marked as needing display are automatically redisplayed when the application returns to the run loop.


This may be due to incomplete download Please write code to check whether the file exists at that location or not. Also you can append path in one line documentsDirectory = [documentsDirectory stringByAppendingPathComponent:@"XML/Extras/Logo.jpg"];

0

精彩评论

暂无评论...
验证码 换一张
取 消