Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dafyddjones2000

macrumors newbie
Original poster
Jan 20, 2012
11
0
Tonyrefail, Wales, UK
hi.
i am new to xcode and i have decided to make a web browser for the mac os x, i have coded the back, forward, refresh, stop, url bar, text bigger, text smaller, print.
i want to know how to make the url bar change when i browse to a new page and how to add a favourites and history center and also if it is possible, make the browser tabbed
thanks in advance
dafyddjones2000,

can i add a home page button to my request please
 
Last edited by a moderator:

thundersteele

macrumors 68030
Oct 19, 2011
2,984
9
Switzerland
Code:
#import <Safari>

Done!


Thanks for the link Red Menace. It might help me with one of the projects that I never will really work on due to lack of time.
 

dafyddjones2000

macrumors newbie
Original poster
Jan 20, 2012
11
0
Tonyrefail, Wales, UK
Help us out a little here - which code? how does it fail (error messages, etc)? did your original browser work?

sorry. i am trying to get the textfield to change when i navigate to a new page and this is the code
Code:
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
{
    // Only report feedback for the main frame.
    if (frame == [sender mainFrame]){
        NSString *url = [[[[frame provisionalDataSource] request] URL] absoluteString];
        [textField setStringValue:url];
    }
}

and

Code:
@property (assign) IBOutlet WebView *webview;
which i connected to the webview in IB using assistant editor. the -void ... fails by unknown type 'Webview and 'Expected a type

----------

sorry. i am trying to get the textfield to change when i navigate to a new page and this is the code
Code:
- (void)webView:(WebView *)sender didStartProvisionalLoadForFrame:(WebFrame *)frame
{
    // Only report feedback for the main frame.
    if (frame == [sender mainFrame]){
        NSString *url = [[[[frame provisionalDataSource] request] URL] absoluteString];
        [textField setStringValue:url];
    }
}

and

Code:
@property (assign) IBOutlet WebView *webview;
which i connected to the webview in IB using assistant editor. the -void ... fails by unknown type 'Webview and 'Expected a type

AppDelegate.h:

Code:
//
//  AppDelegate.h
//  IcySpike Mac
//
//  Created by Dafydd Jones on 17/01/2012.
//  Copyright (c) 2012 IcySpike. All rights reserved.
//

#import <Cocoa/Cocoa.h>



@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet WebView *webview;

AppDelegate.m:

Code:
//
//  AppDelegate.m
//  IcySpike Mac
//
//  Created by Dafydd Jones on 17/01/2012.
//  Copyright (c) 2012 IcySpike. All rights reserved.
//

#import "AppDelegate.h"

- (void) webView:(IBOutlet WebView*webview)sender didStartProvisionalLoadForFrame:(WebFrame *)frame;

    // Only report feedback for the main frame.
-if; (frame == [sender mainFrame]){
        NSString *url = [[[[frame provisionalDataSource] request] URL] absoluteString];
        [textField setStringValue:url];
    }
}
 

Red Menace

macrumors 6502a
May 29, 2011
578
226
Colorado, USA
If you are getting errors about the web view, are you including the WebKit.framework? You aren't going to get much help if people have to guess. Is textField connected to a text field somewhere? Do you even have a working browser?
 

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
Yes i am including the webkit.framework etc

Are you importing it?

The fragments of code you've posted don't show any importing of the Webkit framework. Also, the error message you posted is consistent with failing to import.

See this thread:
https://forums.macrumors.com/threads/1077607/

Notice he imports Webkit headers. Also notice he posts relatively complete code, rather than isolated lines. We can't see what's wrong with your code if you don't post complete code.


Are you following a tutorial or book? If so, what is the URL or title, author, and edition?

If not, what other tutorials or books have you completed?

At this point, it looks to me like you lack fundamental skills. You won't get very far without them, and learning them within the structure of a tutorial or book is more effective than randomly attempting something just because you want to. For example, if I want to fly a helicopter, I can't just hop in the cockpit and take off. I'll need training and practice first.
 

dafyddjones2000

macrumors newbie
Original poster
Jan 20, 2012
11
0
Tonyrefail, Wales, UK
Are you importing it?

The fragments of code you've posted don't show any importing of the Webkit framework. Also, the error message you posted is consistent with failing to import.

See this thread:
https://forums.macrumors.com/threads/1077607/

Notice he imports Webkit headers. Also notice he posts relatively complete code, rather than isolated lines. We can't see what's wrong with your code if you don't post complete code.


Are you following a tutorial or book? If so, what is the URL or title, author, and edition?

If not, what other tutorials or books have you completed?

At this point, it looks to me like you lack fundamental skills. You won't get very far without them, and learning them within the structure of a tutorial or book is more effective than randomly attempting something just because you want to. For example, if I want to fly a helicopter, I can't just hop in the cockpit and take off. I'll need training and practice first.

yes i have forgotten to import the WebKit but now i need to know how to use an NSSegmented Control segments as separate buttons like in finder
 

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
yes i have forgotten to import the WebKit but now i need to know how to use an NSSegmented Control segments as separate buttons like in finder

Are you following a tutorial or book? If so, what is the URL or title, author, and edition?

If not, what other tutorials or books have you completed?

-----

Steps you should follow to answer your question:

1. Google search terms: NSSegmentedControl class reference
(Notice the spelling. There's no space before "Control".)

2. Click the search result that leads to Apple's class reference document.
(It's probably the first search result. That was the purpose of including class reference in the search terms.)

3. On the left side of the class reference doc in the blue sidebar is a COMPANION GUIDE heading. Click the link under that.
(This is a common pattern in Apple reference docs. The class reference links to a COMPANION GUIDE, and the companion guide links to individual CLASS REFERENCE docs.)

4. In the companion guide, click the link Segmented Controls Overview. The third paragraph starts "NSSegmentedControl has these features" and follows it with a list. Read the list item "There are three modes...".
(This tells you what the names of the different modes are, so you can recognize them as you read the rest of the Segmented Controls Programming Guide and the class reference doc. Apple docs are very consistent: when they tell you the name of a mode or feature, it's because they're going to be using that name in the rest of the documentation. So not reading companion guides can leave you not knowing what terms are, and thus unable to find what you're looking for.)

5. Finish reading the companion guide. Then look up the class reference again and read it. For examples, see the links to Related sample code at the top of the class reference doc.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.