2012-01-16 13 views
0

私はObjective-Cで自分自身を改善しようとしていますが、私が今注目しているのは、現在変更と変更と存在しているプロジェクトです。私は一つのことを期待したいすべてをやった。私のプログラムの情報ボタンは.xibファイルに関連していません。私はそれを削除しようとしたが、いつも私のmain.mはSIGABRTのようなエラーが発生しました(int型のretvalの事。)ここでこのボタンをコンパイルエラーなしで無効にするにはどうすればよいですか?

は私が

http://i.stack.imgur.com/ZG51s.png //私のプログラムと情報ボタンの画像を変更したいものです

右下隅にある(i)ボタンを削除しようとしています。

は、ここに私のコード

This is my RootViewController.h 
#import <UIKit/UIKit.h> 

@class MainViewController; 

@interface RootViewController : UIViewController { 

    IBOutlet UIButton *infoButton; //Silinecek 
    MainViewController *mainViewController; 
} 

@property (nonatomic, retain) MainViewController *mainViewController; 

@end 

This is my RootViewController.m 

#import "RootViewController.h" 
#import "MainViewController.h" 


@implementation RootViewController 

@synthesize mainViewController; 


- (void)viewDidLoad { 

    MainViewController *viewController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil]; 
    self.mainViewController = viewController; 
    [viewController release]; 

    [self.view insertSubview:mainViewController.view belowSubview:infoButton]; 
} 

だとも私は私のAppDelegateのHとMを修正しようとしました。どうぞ ;

#import <UIKit/UIKit.h> 

@class RootViewController; 

@interface AppDelegate : NSObject <UIApplicationDelegate> { 
    IBOutlet UIWindow *window; 
    IBOutlet RootViewController *rootViewController; 
} 

@property (nonatomic, retain) UIWindow *window; 
@property (nonatomic, retain) RootViewController *rootViewController; 

@end 

#import "AppDelegate.h" 
#import "RootViewController.h" 

@implementation AppDelegate 


@synthesize window; 
@synthesize rootViewController; 


- (void)applicationDidFinishLaunching:(UIApplication *)application { 

    [window addSubview:[rootViewController view]]; 
    //[window makeKeyAndVisible]; 
} 
/* 
- (void)dealloc { 
    [rootViewController release]; 
    [window release]; 
    [super dealloc]; 
} 
*/ 

ビュー内のその情報ボタンを削除するにはどうすればよいですか。任意のヒント

ためのおかげで、あなたはこのことに興味がある場合は、全体のアルゴリズムです:http://pastebin.com/hHQkQYS6

+0

[self.view insertSubview:mainViewController.view belowSubview:infoButton]; そしてこれは.hでIBOutletとして言及されています。あなたはxibでthrではないと確信していますか? –

+0

はい、私はそれをしました。しかし、私はメインでエラーが発生します.mファイル( ) int(int argc、char * argv []){ \t \t NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; \t int retVal = UIApplicationMain(nil、nil、nil、nil); //ここでエラーが発生しました \t [プールのリリース]; return retVal; } とそのエラー= http://pastebin.com/JBU9pN2J –

+0

例外は、あなたのXIBでまだ 'infoButton'を参照しているという例外があります。あなたはXIBのどこにいるのかを調べ、その参照を削除する必要があります。 – DarkDust

答えて

0

あなたはまだコントロールは、あなたのXIBファイルのどこかにリンクしていますか?これはIBOutletコントロールとして宣言されています。通常、私はこれらのコントロールを持っているとき、私はこのコントロールを何らかの方法でGUIリンクを使用します(私はObj-Cをずっとやっていないのと全く同じことを覚えていません)。しかし、私は間違いなくあなたの周りの外観は、ファイルXIBただろう(と同様に[self.view insertSubview:mainViewController.view belowSubview:infoButton];

+0

私はどこでも見ましたが、私はそれを見つけることができませんでした私は'XIBファイル 'と'infoButton'の間のポイントを見つけることができません –

+0

あなたはXIBにあるすべてのオブジェクトを示すXCodeで使用できるオブジェクトエクスプローラタイプのインターフェイスはありますか? – mrstebo

+0

http://img407.imageshack.us/img407/1359/screenshot20120116at143。png これは私のオブジェクトと参考資料です。これは完全なアルゴリズムです。http://pastebin.com/hHQkQYS6 私はオブジェクトエクスプローラを今すぐチェックしています –

0

を削除する例外が言及:

[<RootViewController 0x4b9ab20> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key infoButton. 

コールスタックだから、これはペン先のロード中に起こっている、それがUINibによってスローされていることを示しています。ので、慎重に、ペン先のすべてのオブジェクトを確認し、情報ボタンを削除します

+0

私はそれらをすべてチェックしましたが、infoButtonについて何も見つかりません:/私は完全に新しいプロジェクトに書き直すべきですか? http://img171.imageshack.us/img171/3397/screenshot20120116at145.png –

関連する問題