开发者

How to create a dynamic page in iPhone

I want to use a page in our xib which is change every month,This page contain text,song,and image.

Please tell me how i perform this,I think i put my song,image,and text file on the server and change every month song,image and text on the server which is automatically chan开发者_如何转开发ged in our application.

If i am right then suggest me how i perform this, If not then please tell me how i add this functionality in our application.

Thanks,

Arun


Keep local copies of your text, music and images, so you don't have to retrieve them from the server every time you use your app and also have something to show when you don't have Internet connectivity. Pull the current month's data from the server if the app doesn't already have it, in the background, so the user doesn't have to wait for it to be downloaded before using your app and then transition to the new theme once you've downloaded the necessary files.

As for the implementation, use NSURLConnection and write your data to a local file:

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    filename = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:save_name];
    NSFileHandle *file1 = [NSFileHandle fileHandleForUpdatingAtPath: filename];
    [file1 writeData: data];
    [file1 closeFile];
}

For extra details, check out this example.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜