Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 20, 2012, 04:43 PM   #1
dafyddjones2000
macrumors newbie
 
Join Date: Jan 2012
Location: 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 maflynn; Jan 20, 2012 at 06:52 PM. Reason: Consecutive Posts
dafyddjones2000 is offline   0 Reply With Quote
Old Jan 20, 2012, 05:28 PM   #2
Red Menace
macrumors 6502
 
Join Date: May 2011
Location: Littleton, Colorado, USA
So, I'm guessing that you haven't read the WebKit Programming Guide?
__________________
MacBook Pro / OS X Yosemite (10.10) / Xcode 6.1 / RubyMotion FTW
Red Menace is offline   0 Reply With Quote
Old Jan 20, 2012, 06:09 PM   #3
thundersteele
macrumors 68030
 
Join Date: Oct 2011
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.
thundersteele is offline   0 Reply With Quote
Old Jan 23, 2012, 03:01 PM   #4
dafyddjones2000
Thread Starter
macrumors newbie
 
Join Date: Jan 2012
Location: Tonyrefail, Wales, UK
Re:

i have now read the documentation but i insert the code and the build fails. also do i type the code in AppDelegate.m or .h?

Last edited by dafyddjones2000; Jan 23, 2012 at 03:02 PM. Reason: add a bit on
dafyddjones2000 is offline   -1 Reply With Quote
Old Jan 23, 2012, 03:07 PM   #5
Red Menace
macrumors 6502
 
Join Date: May 2011
Location: Littleton, Colorado, USA
Help us out a little here - which code? how does it fail (error messages, etc)? did your original browser work?
__________________
MacBook Pro / OS X Yosemite (10.10) / Xcode 6.1 / RubyMotion FTW
Red Menace is offline   1 Reply With Quote
Old Jan 23, 2012, 03:19 PM   #6
dafyddjones2000
Thread Starter
macrumors newbie
 
Join Date: Jan 2012
Location: Tonyrefail, Wales, UK
Quote:
Originally Posted by Red Menace View Post
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

----------

Quote:
Originally Posted by dafyddjones2000 View Post
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];
    }
}
dafyddjones2000 is offline   0 Reply With Quote
Old Jan 23, 2012, 03:49 PM   #7
Red Menace
macrumors 6502
 
Join Date: May 2011
Location: Littleton, 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?
__________________
MacBook Pro / OS X Yosemite (10.10) / Xcode 6.1 / RubyMotion FTW
Red Menace is offline   0 Reply With Quote
Old Feb 10, 2012, 10:47 AM   #8
dafyddjones2000
Thread Starter
macrumors newbie
 
Join Date: Jan 2012
Location: Tonyrefail, Wales, UK
Quote:
Originally Posted by Red Menace View Post
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?
Yes i am including the webkit.framework etc
dafyddjones2000 is offline   0 Reply With Quote
Old Feb 10, 2012, 11:25 AM   #9
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by dafyddjones2000 View Post
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:
http://forums.macrumors.com/showthread.php?t=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.
chown33 is offline   0 Reply With Quote
Old Feb 12, 2012, 10:31 AM   #10
dafyddjones2000
Thread Starter
macrumors newbie
 
Join Date: Jan 2012
Location: Tonyrefail, Wales, UK
Quote:
Originally Posted by chown33 View Post
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:
http://forums.macrumors.com/showthread.php?t=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
dafyddjones2000 is offline   0 Reply With Quote
Old Feb 12, 2012, 01:40 PM   #11
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by dafyddjones2000 View Post
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.
chown33 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Which Web Browser? Tsepz iPad Apps 16 Apr 8, 2014 07:03 PM
Web Browser Issues I.Algar Mac Basics and Help 2 Mar 4, 2014 03:21 AM
Classilla or Another Web Browser? Christine1234 PowerPC Macs 4 Jul 6, 2013 04:57 PM
Lotus Web Browser... ColaCube iPhone and iPod touch Apps 0 Jan 10, 2013 11:32 AM
Retina - Web Browser Jaxd Mac Applications and Mac App Store 2 Jan 5, 2013 01:12 AM

Forum Jump

All times are GMT -5. The time now is 12:38 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC