0
我做了tableView
與第二個視圖與功能從plist加載數據。它可以工作,但我想將plist放在服務器上,這樣當我更改plist上的數據時,應用程序會自動刷新。iphone應用程序 - 在服務器上的plist(自動刷新)
代碼:
// Get a plist and copy in its contents into an array
- (id)initWithLibraryName:(NSString *)libraryName {
if ((self = [super init])) {
libraryPlist = libraryName;
libraryContent = [[NSArray alloc] initWithContentsOfFile:
[[NSBundle mainBundle] pathForResource:libraryPlist
ofType:@"plist"]];
}
return self;
}
// [Safely] returns a "DVD" from the plist. Each item in the data source is a
// dictionary containing data about the chosen DVD.
- (NSDictionary *)libraryItemAtIndex:(int)index {
return (libraryContent != nil &&
[libraryContent count] > 0 &&
index < [libraryContent count])
? [libraryContent objectAtIndex:index] : nil;
}