Перезагрузите UIWebView с кнопки с IBAction - PullRequest
1 голос
/ 03 мая 2011

Я создаю приложение, которое использует UIWebView для отображения расписания.Я добавил кнопку, которая при нажатии загружает обновленное расписание с веб-сервера.Я пытался заставить действие этой кнопки также обновить UIWebView при использовании [iPadscheduleView reload];это не дает никакого эффекта.

Мой viewDidLoad

-(void)viewDidLoad {


NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
                                                     NSUserDomainMask,
                                                     YES);

NSString *fullPath = [[paths lastObject] stringByAppendingPathComponent:@"schedule.html"]; 
NSURL *url = [NSURL fileURLWithPath:fullPath];
[iPadscheduleView loadRequest:[NSURLRequest requestWithURL: url]];
[super viewDidLoad];
}

мой IBAction для кнопки

-(IBAction)synctheschedule {
 NSData *fetchedData = [NSData dataWithContentsOfURL:[NSURL  URLWithString:@"http://www.elitespark.com/schedule.html"]];
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *filePath = [documentsPath stringByAppendingPathComponent:@"schedule.html"];
[fetchedData writeToFile:filePath atomically:YES];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Popup" message:@"The schedule has been synced with the server." delegate:nil cancelButtonTitle:@"Refresh" otherButtonTitles:nil];
[alert show];
[alert release];    
[iPadscheduleView reload];
}

Любая помощь будет принята с благодарностью.Спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...