3

Can anyone please tell me how to reload the view.In my program,it contain a tab view controller.There is one item named "A" in the tab.And this "A" item is pointing to a viewController.In that view Controller, it is displaying some datas and I have included UIActionSheet in that. There is one button-Delete in the actionsheet.This delete button is for deleting the particular data.Now my problem is that I need to reload that view so that these deleted data should not be displayed. So anyone please tell me how to reload the page. I have included the following code before

[self presentModalViewController:historyView animated:YES];
[historyView setNeedsDisplay];

but it is showing some error :-

 No visible @interface for viewcontroller declares the selector 'setNeedsDisplay'

Please tell me the solution.. :(

1 Answer 1

6

UIViewController class doesn't have a method setNeedsDisplay. The UIView class does have this method. So you can write like that:

[historyView.view setNeedsDisplay];

But this method doesn't reload a view. It just marks the receiver’s entire bounds rectangle as needing to be redrawn (from apple documentation iOS Developer Library). So as a result the drawRect method will be called.

To solve your problem you can create your own function like initializeUI in your view controller and then call it when the view is loaded initially (in viewDidLoad method) and for example after deleting the data when you need the view to be updated.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.