iosfreak
iosfreak

Reputation: 5238

UIView Shows perfect on the Simulator, but not iPhone?

Okay,

I have a really weird problem. When switching over to a different XIB, it shows on simulator but not on my test device. I will provide some code and screenshots of my layout in interface builder! Thanks in advance.

SettingsViewController.h

//
//  SettingsViewController.h
//
//  Created by Coulton Vento on 2/26/11.
//  Copyright 2011 Your Way Websites. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "TableViewAppDelegate.h"
#import "Sqlite.h"

@class SettingsStoreViewController;

@interface SettingsViewController : UIViewController {

}

@end

SettingsViewController.m

#import "SettingsViewController.h"
#import "TableViewAppDelegate.h"

@implementation SettingsViewController

- (void)viewDidLoad {
NSString *myDB = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"flashpics.db"];
database = [[Sqlite alloc] init];
[database open:myDB];

TableViewAppDelegate *dataCeter = (TableViewAppDelegate *)[[UIApplication sharedApplication] delegate];

myTimer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector: @selector(updateNumber) userInfo: nil repeats: YES];

self.navigationItem.title = @"Album Settings";

NSString *post =[NSString stringWithFormat:@"id=%@", dataCeter.dataTwo];
NSString *hostStr = @"http://myflashpics.com/iphone_processes/get_album.php?";
hostStr = [hostStr stringByAppendingString:post];
NSData *dataURL =  [NSData dataWithContentsOfURL: [ NSURL URLWithString: hostStr ]];    
NSString *serverOutput = [[NSString alloc] initWithData:dataURL encoding: NSASCIIStringEncoding];

if ([serverOutput rangeOfString:@"yes"].location == NSNotFound) {
    //NSLog(@"Fail - %@ / %@", usernameField.text, passwordField.text);
    UIAlertView *alertsuccess = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Please check your internet connection" delegate:self cancelButtonTitle:@"Try Again" otherButtonTitles:nil, nil];
    [alertsuccess show];
    [alertsuccess release];
    [alertsuccess setTag:6];
} else {

    NSArray *myWords = [serverOutput componentsSeparatedByString:@"?!?divide?!?"];
    NSString *albumNameResults = [myWords objectAtIndex:1]; 
    NSString *albumCommentsResults = [myWords objectAtIndex:2];
    NSString *albumPrivateResults = [myWords objectAtIndex:3];
    NSString *numberOfConnections = [myWords objectAtIndex:4];

    albumName.text = albumNameResults;

    numberButton.text = numberOfConnections;

    if ([numberOfConnections isEqualToString:@"1"]) {
        connectionsButton.text = @"Connection";
    } else {
        connectionsButton.text = @"Connections";
    }


    if ([albumCommentsResults isEqualToString:@"yes"]) {
        [albumComments setOn:YES animated:YES];
    } else {
        [albumComments setOn:NO animated:YES];
    }

    if ([albumPrivateResults isEqualToString:@"yes"]) {
        [albumPrivate setOn:YES animated:YES];
    } else {
        [albumPrivate setOn:NO animated:YES];
    }
}

}

DetailViewController.h

#import <UIKit/UIKit.h>
#import "Sqlite.h"
#import "OHGridView.h"
#import "BigView.h"
#import "SettingsViewController.h"
#import "processViewController.h"

@class SecondView;
@class BigView;
@class CaptionView;

@interface DetailViewController : UIViewController <OHGridViewDelegate, OHGridViewDataSource> {
}
@end

DetailViewController.m

//
//  DetailViewController.m
//  TableView
//
//  Created by iPhone SDK Articles on 1/17/09.
//  Copyright www.iPhoneSDKArticles.com 2009. 
//

#import "DetailViewController.h"
#import "TableViewAppDelegate.h"
#import "processViewController.h"


@implementation DetailViewController

@synthesize selectedCountry;
@synthesize selectedID;



- (IBAction)switchViews {
[self presentModalViewController:bigView animated:YES];
}


- (void)viewWillAppear {
[(OHGridView *)self.view reloadData];
NSLog(@" --- %@ --- ", items);
}

- (IBAction)showSettings {

TableViewAppDelegate *dataCeter = (TableViewAppDelegate *)[[UIApplication sharedApplication] delegate];
dataCeter.dataTwo = selectedID;

SettingsViewController *screentwothree = [[SettingsViewController alloc] initWithNibName:nil bundle:nil];
screentwothree.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:screentwothree animated:YES];
[screentwothree release];

//[self.navigationController pushViewController:screentwothree animated:YES];
//[screentwothree release];
//screentwothree = nil;
}

/*
 // Override to allow orientations other than the default portrait orientation.
 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
 // Return YES for supported orientations

return (interfaceOrientation == UIInterfaceOrientationPortrait); } */

- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
// Release anything that's not essential, such as cached data
}


- (void)dealloc {

[selectedCountry release];
[lblText release];
[super dealloc];
}


@end

Sorry for all the code.

Upvotes: 0

Views: 328

Answers (1)

Caleb
Caleb

Reputation: 124997

This sort of thing is often due to a difference in file systems: MacOS is typically case-insensitive, while iOS is always case-sensitive. So if you specify the .xib as "myview.xib" but it's actual name is "MyView.xib", that'll generally work on the simulator but not on the device. Same thing happens with images and other resources.

Upvotes: 2

Related Questions