そのため、私はアプリストアにあるアプリの重要な更新に取り組んでいます。タブバーとナビゲーションコントローラーを備えたアプリがあります。ユーザーがリストからアイテムを選択すると、サーバーから送信されたxmlファイルから取得したリンクがWebビューのみの詳細ビューコントローラーに送信されます。私が抱えている問題は、ユーザーがそのタブのルートビューであるテーブルビューに戻ったときに、詳細ビューが解放されていないことです。アプリで他のオプションを選択しても、詳細ビューは変更されません。私のデータがuisharedアプリケーションデータから解放されていないわけではありませんが、ビューは解放されていません。私はここにこのような似たようなアイテムがたくさんあることを知っています、そして私はそれらのすべてを試しました。私はあなたに私のコードのいくつかを与え、他のヒントやコツに大いに感謝します。Im 15で、開発を始めたばかりなので、どんな情報でも役に立ちます。これが私が誰かが助けるために必要だと思うコードです。
TableViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
NSString * storyLink = [[stories objectAtIndex: storyIndex] objectForKey: @"link"];
// clean up the link - get rid of spaces, returns, and tabs...
storyLink = [storyLink stringByReplacingOccurrencesOfString:@" " withString:@""];
storyLink = [storyLink stringByReplacingOccurrencesOfString:@"\n" withString:@""];
storyLink = [storyLink stringByReplacingOccurrencesOfString:@" " withString:@""];
videoDetailViewController.title = @"Videos";
ExampleAppDataObject* theDataObject = [self theAppDataObject];
theDataObject.videoData = storyLink;
if (self.videoDetailViewController == nil)
{
VideoDetailViewController *aBookDetail = [[[VideoDetailViewController alloc] initWithNibName:@"VideosDetailView" bundle:[NSBundle mainBundle]] autorelease];
self.videoDetailViewController = aBookDetail;
[aBookDetail release];
aBookDetail = nil;
}
[self.navigationController pushViewController:videoDetailViewController animated:YES];
}
DetailViewController:
#import "VideoDetailViewController.h"
#import "RSSEntry.h"
#import "ExampleAppDataObject.h"
#import "AppDelegateProtocol.h"
@implementation VideoDetailViewController
@synthesize activityIndicator;
@synthesize webView;
@synthesize pasteboard;
- (ExampleAppDataObject*) theAppDataObject;
{
id<AppDelegateProtocol> theDelegate = (id<AppDelegateProtocol>) [UIApplication sharedApplication].delegate;
ExampleAppDataObject* theDataObject;
theDataObject = (ExampleAppDataObject*) theDelegate.theAppDataObject;
return theDataObject;
}
- (void)viewDidLoad
{
ExampleAppDataObject* theDataObject = [self theAppDataObject];
NSString *urladdress = theDataObject.videoData;
NSURL *url = [NSURL URLWithString:urladdress];
NSURLRequest *requestobj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestobj];
pasteboard = [UIPasteboard generalPasteboard];
[super viewDidLoad];
}
- (void)dealloc
{
[webView release];
webView = nil;
[activityIndicator release];
[pasteboard release];
[VideoDetailViewController release];
[urlData release];
urlData = nil;
[super dealloc];
}
@end
必要だとは思わなかったコードをたくさんスキップしました。実際のファイルが必要な場合は、evan.stoddard@me.comまでメールでお問い合わせください。