好,
我有一个非常奇怪的问题。切换到不同的XIB时,它会在模拟器上显示,但不会在我的测试设备上显示。我将在界面构建器中提供我的布局的一些代码和屏幕截图!提前谢谢。
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
对不起所有代码。
答案 0 :(得分:2)
这种情况通常是由于文件系统的不同:MacOS通常不区分大小写,而iOS始终区分大小写。因此,如果您将.xib指定为“myview.xib”,但它的实际名称是“MyView.xib”,那么它通常可以在模拟器上运行,但不能在设备上运行。图像和其他资源也是如此。