#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    2
    Rep Power
    0

    Developer new to iPhone


    Hello Everyone,

    I'm familiar with quite a number of languages, but I just can't seem to get objective-c.

    I'm trying to write a basic temp convertor programmer just to understand the basics of the languages, but I keep getting errors and warnings.

    The main error I'm getting is " Can't convert to pointer"

    here's my .h file:

    Code:
    //
    //  tempConvertViewController.h
    //  tempConvert
    //
    //  Created by Abel Gancsos on 5/22/10.
    //  Copyright __MyCompanyName__ 2010. All rights reserved.
    //
    
    #import <UIKit/UIKit.h>
    
    @interface tempConvertViewController : UIViewController {
    	
    	IBOutlet UITextField *temp;
    	IBOutlet UITextField *type;
    	IBOutlet UILabel *final;
    	
    	double tempValue;
    	char typeValue;
    
    }
    
    -(IBAction) convert:(id)sender;
    @end
    and here's the .m file

    Code:
    //
    //  tempConvertViewController.m
    //  tempConvert
    //
    //  Created by Abel Gancsos on 5/22/10.
    //  Copyright __MyCompanyName__ 2010. All rights reserved.
    //
    
    #import "tempConvertViewController.h"
    
    @implementation tempConvertViewController
    
    -(IBAction)convert:(id)sender{
    	
    	tempValue=
    	if(typeValue=='C'|| typeValue=='c'){
    		
    		tempValue=(((tempValue/5)*9)+32);
    		
    		[final setText:[tempValue text]];
    	}
    	
    	
    	if(typeValue=='F'||typeValue=='f'){
    		
    		tempValue=(((tempValue-32)*5)/9);
    		
    		[final setText:[tempValue text]];
    	}
    
    	
    	
    	
    }
    
    
    /*
    // The designated initializer. Override to perform setup that is required before the view is loaded.
    - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
        if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
            // Custom initialization
        }
        return self;
    }
    */
    
    /*
    // Implement loadView to create a view hierarchy programmatically, without using a nib.
    - (void)loadView {
    }
    */
    
    
    /*
    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad {
        [super viewDidLoad];
    }
    */
    
    
    /*
    // Override to allow orientations other than the default portrait orientation.
    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
        // Return YES for supported orientations
        return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    */
    
    - (void)didReceiveMemoryWarning {
    	// Releases the view if it doesn't have a superview.
        [super didReceiveMemoryWarning];
    	
    	// Release any cached data, images, etc that aren't in use.
    }
    
    - (void)viewDidUnload {
    	// Release any retained subviews of the main view.
    	// e.g. self.myOutlet = nil;
    }
    
    
    - (void)dealloc {
        [super dealloc];
    }
    
    @end
    Any ideas? I know that if I can understand what's going on, then I can understand the basics of objective-c.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2010
    Posts
    2
    Rep Power
    0
    Anyone?......
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    2
    Rep Power
    0

    Heres some help


    Originally Posted by computerfox
    Anyone?......

    I took a few hours out and did some coding for you. Im a newbie, but I aint giving up.

    Most of it is done for you, still some parts left.

    Everythings there, appdelegate class, viewcontrolller and nib file. etc


    h t t p : / / w w w . m j c a r s p a r e s . c o . u k / p r o j y . z i p


    pasted below as well. (I obviously cant paste the NIB file here!)




    //
    // tempConvertViewController.h
    // tempConvert
    //
    // Created by Qessar on 13/06/2010.
    // Copyright __MyCompanyName__ 2010. All rights reserved.
    //

    #import <UIKit/UIKit.h>

    @interface tempConvertViewController : UIViewController {


    IBOutlet UITextField *temp;
    IBOutlet UITextField *type;
    IBOutlet UILabel *final;

    }


    @property (nonatomic, retain) IBOutlet UITextField *temp;
    @property (nonatomic, retain) IBOutlet UITextField *type;
    @property (nonatomic, retain) IBOutlet UILabel *final;


    -(IBAction) convert;




    @end



    //
    // tempConvertViewController.m
    // tempConvert
    //
    // Created by Qessar on 13/06/2010.
    // Copyright __MyCompanyName__ 2010. All rights reserved.
    //

    #import "tempConvertViewController.h"

    @implementation tempConvertViewController


    @synthesize temp;

    @synthesize type;

    @synthesize final;



    -(IBAction)convert{


    }




    - (BOOL)textFieldShouldReturnUITextField *)textField {

    double tempValue = [temp.text doubleValue];

    if ([type.text isEqualToString:@"C"] || [type.text isEqualToString:@"c"]) {

    tempValue = (((tempValue/5)*9)+32);

    }



    NSString *result = [NSString stringWithFormat:@"%f", tempValue];

    [temp resignFirstResponder];
    final.text = result;
    [textField resignFirstResponder];
    return YES;

    }




    /*
    // The designated initializer. Override to perform setup that is required before the view is loaded.
    - (id)initWithNibNameNSString *)nibNameOrNil bundleNSBundle *)nibBundleOrNil {
    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
    // Custom initialization
    }
    return self;
    }
    */

    /*
    // Implement loadView to create a view hierarchy programmatically, without using a nib.
    - (void)loadView {
    }
    */


    /*
    // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
    - (void)viewDidLoad {
    [super viewDidLoad];
    }
    */


    /*
    // Override to allow orientations other than the default portrait orientation.
    - (BOOL)shouldAutorotateToInterfaceOrientationUIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
    }
    */

    - (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Release any cached data, images, etc that aren't in use.
    }

    - (void)viewDidUnload {
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
    }


    - (void)dealloc {
    [super dealloc];
    }

    @end
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Posts
    1
    Rep Power
    0
    Hi,
    I would like to get an iphone, but the new one is very expensive. However, the iphone 3G is cheaper and so i was wondering, are you able to download features such as horizontal texting on to the iphone? Can you give me a site if possible that would let me know this. Thanks in advance!
    ____________________________
    free calls from PC to mobile
  8. #5
  9. Blowing up trees with my mind.
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Feb 2005
    Location
    Neverland Ranch, minus the touching.
    Posts
    3,382
    Rep Power
    2567
    I'm guessing you're running it unlocked on tmobile? Otherwise if you're worried about money you can get a 3gs from att for 99.

    But yes, the updated os has landscape.

IMN logo majestic logo threadwatch logo seochat tools logo