Xcode empty ViewController.xib

Discussion in 'iOS Programming' started by Pades, Aug 6, 2013.

  1. Pades macrumors newbie

    Joined:
    Aug 6, 2013
    #1
    I have a problem with my app in xcode. It worked good but when I tried Indicator my ViewController.xib doesnt show iphone. I have only empty ViewController.xib and iOS simulator return "Thread 1 : signal SIGABRB". I'm desperate I am trying everything. But it always doesnt work. I add my complete app. Thank you for replies.

    Code:
    https://mega.co.nz/#!GJMDXKTQ!E2MEp3XC1otB_zv935JVGDnJVV4mrIGVaY_2APX5wWs
     
  2. Tander macrumors 6502a

    Tander

    Joined:
    Oct 21, 2011
    Location:
    Johannesburg, South Africa
    #2
    Rather post the code here for everyone to see - will be much easier than downloading the project.
     
  3. Pades thread starter macrumors newbie

    Joined:
    Aug 6, 2013
  4. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #4
    What Tander meant was that we normally post code in these forums using the
    Code:
     tags. As in:
    
    [B]AppDelegate.h[/B]
    [CODE]#import <UIKit/UIKit.h>
    
    @class ViewController;
    
    @interface AppDelegate : UIResponder <UIApplicationDelegate>
    
    @property (strong, nonatomic) UIWindow *window;
    
    @property (strong, nonatomic) ViewController *viewController;
    
    @end
    See this Sticky for more help: Posting code, please use the
    Code:
     tags[/URL]
     
  5. Pades, Aug 6, 2013
    Last edited: Aug 6, 2013

    Pades thread starter macrumors newbie

    Joined:
    Aug 6, 2013
    #5
    I am sorry is it better
    ViewController.m
    Code:
    #import "ViewController.h"
    
    @interface ViewController ()
    
    @end
    
    @implementation ViewController
    @synthesize Label, Name, Stav, Stav2;
    
    -(IBAction)Button1:(id)sender
    {
        NSMutableURLRequest *urlRequest = [[[NSMutableURLRequest alloc] init] autorelease];
        NSString *urlString = [NSString stringWithFormat:@"http://freetech.sk/test.php?name=%@",Name.text];
        [urlRequest setURL:[NSURL URLWithString:urlString]];
        
        NSData *urlData;
        NSURLResponse *response;
        NSError *error;
        urlData = [NSURLConnection sendSynchronousRequest:urlRequest returningResponse:&response error:&error];
        if(!urlData) {
            Stav.text = @"Nepodarilo sa pripojit.";
        }
        else
        {
            NSString *aStr = [[[NSString alloc] initWithData:urlData encoding:NSUTF8StringEncoding]autorelease];
            if([aStr isEqualToString: @"1"])
            {
                Free.hidden = YES;
                Stav2.hidden = YES;
                booked.hidden = NO;
                Stav.hidden = NO;
            }
            else
            {
                booked.hidden = YES;
                Stav.hidden = YES;
                Free.hidden = NO;
                Stav2.hidden = NO;
            }
        }
    
    }
    
    -(void) textFieldShouldReturn: (id) sender
    {
        [sender resignFirstResponder];
    }
    
    -(IBAction)dismissKeyboard
    {
        [Name resignFirstResponder];
    }
    
    - (void)viewDidLoad
    {
        [super viewDidLoad];
        Stav.hidden=YES;
        Stav2.hidden=YES;
    
    
    }
    
    - (void)didReceiveMemoryWarning
    {
        [super didReceiveMemoryWarning];
        // Dispose of any resources that can be recreated.
    }
    
    - (void)dealloc {
        [super dealloc];
    }
    @end
    ViewController.h
    Code:
    #import <UIKit/UIKit.h>
    
    @interface ViewController : UIViewController
    
    {
        UILabel *Label;
        UITextField *Name;
        UILabel *Stav;
        UILabel *Stav2;
        IBOutlet UIImageView *Free;
        IBOutlet UIImageView *booked;
    }
    
    @property (nonatomic, retain) IBOutlet UILabel *Label;
    @property (nonatomic, retain) IBOutlet UITextField *Name;
    @property (nonatomic, retain) IBOutlet UILabel *Stav;
    @property (retain, nonatomic) IBOutlet UILabel *Stav2;
    
    -(IBAction)Button1:(id)sender;
    -(IBAction)dismissKeyboard;
    
    @end
     
  6. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
  7. Pades thread starter macrumors newbie

    Joined:
    Aug 6, 2013
    #7
    And it also solves my problem with the fact that I disappeared from everything. XIB?
     
  8. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #8
    Maybe. First, get the app to run without crashing. Then you can concentrate on debugging why your screen doesn't show.
     

Share This Page