【发布时间】:2013-03-23 11:02:07
【问题描述】:
我是 Objective C 编程和使用可可应用程序的新手。
这是我的 static URL 基于 webview 的应用程序。
AppDelegate.h 包含
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet WebView *webview;
@end
而我的 AppDelegate.m 包含
@implementation AppDelegate
@synthesize webview;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSString *urlString = @"http://www.google.com";
[[webview mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];
}
@end
使用这个指定的URL 可以正常工作。
我正在尝试找出使我能够配置 URL 的解决方案。 例如,从单独的窗口保存 URL,并通过点击“保存”按钮使用新指定的 URL 加载我的 webview。
提前致谢
【问题讨论】:
-
请添加更多描述,关于如何配置和保存 URL。
-
现在,当我运行我的应用程序时,它会向我显示带有指定 URL 的 webview。好的。例如,我在菜单中有设置选项,它应该使我能够更改 url 等。
-
此菜单存在于您的应用程序级别或网站级别?如果它在应用程序级别,那么正如 Eli 所建议的那样是正确的。
标签: objective-c xcode cocoa webview nsapplication