toolchain webbrowser help needed

Discussion in 'iOS Development' started by deleted account, Apr 27, 2009.

  1. hi,
    i wanna make an fullscreen webbrowser for the iphone..

    but i don't know how to make: an addressbar, reload button, add to favorites button, tabs button like in mobile safari, history, settings...

    maybe anyone can help me coding?!

    here's what i got..

    you can compile it using the iphone 2.0 toolchain from bigboss

    main.m
    Code:
    #import <UIKit/UIKit.h>
    #import "iNet.h"
    
    int main(int argc, char *argv[])
    {
        NSAutoreleasePool* pool = [ [ NSAutoreleasePool alloc ] init ];
        int appReturn = UIApplicationMain(argc, argv, @"iNet", @"iNet");
        return appReturn;
        [ pool release ];
    }
    
    iNet.m
    Code:
    import "iNet.h"
    
    @implementation iNet
    
    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
    {
    
        [UIHardware _setStatusBarHeight:0.0f];
        [self setStatusBarHidden:YES animated:NO];
    
        rect = [ UIHardware fullScreenApplicationContentRect ];
        rect.origin.x = 0.0f;
        rect.origin.y = 0.0f;
    
        window = [ [ UIWindow alloc ] initWithContentRect: rect ];
        [ window makeKeyAndVisible ];
    
        mainView = [ [ UIView alloc ] initWithFrame: rect ];
        [ window setContentView: mainView ];
    
        navBar = [ [ UINavigationBar alloc ] initWithFrame: CGRectMake(rect.origin.x, rect.origin.y, rect.size.width, 45.0f) ];
        [ navBar pushNavigationItem: [ [ UINavigationItem alloc ] initWithTitle:@"iNet" ] ];
        [ navBar showLeftButton:nil withStyle:nil rightButton:@"about" withStyle: 0 ];
        [ navBar setDelegate: self ];
        [ mainView addSubview: navBar ];
    
        webView = [ [ UIWebView alloc ] initWithFrame: CGRectMake(rect.origin.x, rect.origin.y + [ navBar bounds ].size.height, rect.size.width, rect.size.height - [ navBar bounds ].size.height) ];
        NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"];
        NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile];
        [webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];
        [ mainView addSubview: webView ];
    }
    
    - (void)dealloc
    {
        [ window release ];
        [ mainView release ];
        [ navBar release ];
        [ super dealloc ];
    }
    
    - (void)navigationBar:(UINavigationBar*)bar buttonClicked:(int)button
    {
        UIAlertSheet *sheet = [ [ UIAlertSheet alloc ] init ];
        [ sheet setTitle: @"about" ];
        [ sheet setBodyText:@"\niNet v1.0" ];
        [ sheet setDelegate: self ];
        [ sheet addButtonWithTitle:@"OK" ];
        [ sheet popupAlertAnimated: YES ];
    }
    
    - (void)alertSheet:(UIAlertSheet*)sheet buttonClicked:(int)button
    {
        [ sheet dismiss ];
    }
    
    @end
    
    iNet.h
    Code:
    #import <Foundation/Foundation.h>
    #import <CoreFoundation/CoreFoundation.h>
    #import <UIKit/UIKit.h>
    #import <UIKit/UIHardware.h>
    #import <UIKit/UIWindow.h>
    #import <UIKit/UIView.h>
    #import <UIKit/UIWebView.h>
    
    @interface iNet : UIApplication
    {
        CGRect rect;
        UIWindow* window;
        UIView* mainView;
        UIWebView* webView;
        UINavigationBar* navBar;
    }
    
    - (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
    - (void)dealloc;
    
    @end
    
    Makefile
    Code:
    CC=arm-apple-darwin9-gcc
    LD=$(CC)
    LDFLAGS =    -framework Foundation \
                    -framework UIKit \
                    -framework CoreFoundation \
                    -framework CoreGraphics \
                    -lobjc \
                    -L"/usr/lib" \
                    -F"/System/Library/Frameworks" \
                    -F"/System/Library/PrivateFrameworks" \
                    -bind_at_load
    CFLAGS=-I/var/include
    
    TARGET=Window
    
    all:    $(TARGET)
    
    $(TARGET): main.o iNet.o
        $(LD) $(LDFLAGS) -o $@ $^
                ldid -S $(TARGET)
                chmod 0755 $(TARGET)
    
    %.o:    %.m
        $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@
    
    clean:   
        rm -fr *.o $(TARGET)
    
    Last edited by a moderator: Oct 5, 2014
  2. SkylarEC

    SkylarEC Super Moderator Emeritus Staff Member

    Joined:
    Sep 19, 2007
    Messages:
    6,642
    Likes Received:
    129
    In other words, you want someone here to make an entire app for you. : (
  3. no maybe anyone can give me some code snippets or explains me how to do..
  4. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    What you do is search google and or buy some books about programming in Objective-C from amazon. I recommend The iPhone Developers Cookbook and Programming in Objective C which can be easily found on amazon.
  5. fast1

    fast1 Banned

    Joined:
    Apr 6, 2009
    Messages:
    96
    Likes Received:
    0
    haha i think you need a coach...

    Please Register or Log in to view images

  6. wardlaw

    wardlaw New Member

    Joined:
    Apr 22, 2009
    Messages:
    43
    Likes Received:
    0

    Please Register or Log in to view images

    use search in google or yahoo.. it might help.
  7. hmm would be great


    nope.. i searched for month and i found nothing..

    Please Register or Log in to view images



    sry but i have no mac and no sdk..
  8. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    What does not having a mac or the SDK have to do with learning Objective-C? Nothing, that’s what it has nothing to do with learning Objective-C it doesn’t make the slightest difference if you haven't got the SDK or a mac. You can still read books to learn that language.
  9. yes but the books are for development with the sdk and i can't use the code samples in the books because i compile the app with the toolchain..
  10. Chicken

    Chicken Retired Moderator

    Joined:
    Feb 17, 2008
    Messages:
    2,494
    Likes Received:
    7
    Device:
    iPhone 5S
    The code is EXACTLY the same, you don't have a different language for the toolchain and another one for the SDK, they are EXACTLY the same.

Share This Page