English 中文(简体)
统一婚姻
原标题:Subclassing UIWindow

我只是想把“金dow” sub倒,以便我能够拦截一些通知。 除下文所列法典外,我还进入了MainWindow.xib,并更新了IDWindow对我的子阶级的反对。 问题在于我表格上的表格没有反应(例如,我仅添加一个表格,但在我看来我有多个(不是问题)。 谁会看到我会做什么错误呢? 感谢。

UISubclassedWindow.h

#import <UIKit/UIKit.h>

@interface UISubclassedWindow : UIWindow 
{

}

@end

www.un.org/Depts/DGACM/index_french.htm

    #import "UISubclassedWindow.h"

    @implementation UISubclassedWindow

- (id) initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) 
    {
        NSLog(@"init");
    }
    return self;
}

    - (void)makeKeyAndVisible
    {
        [super makeKeyAndVisible];
        NSLog(@"makeKeyAndVisible");
    }

    - (void)becomeKeyWindow
    {
        [super becomeKeyWindow];
        NSLog(@"becomeKeyWindow");

    }

    - (void)makeKeyWindow
    {
        [super makeKeyWindow];
        NSLog(@"makekeyWindow");
    }

    - (void)sendEvent:(UIEvent *)event
    {
    }

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

    @end

<>AppDelegate.h

import

@队长

@interface My_AppAppDelegate : NSObject <UIApplicationDelegate> 
{
    UISubclassedWindow *window;
}

@property (nonatomic, retain) IBOutlet UISubclassedWindow *window;

@end

<>AppDelegate.m

@synthesize window;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{   
    UITabBarController *tabBarController = [[UITabBarController alloc] init];

    MainViewController *mainViewController = [[MainViewController alloc] initWithViewType: 0];
    UINavigationController *mainNavigationController = [[UINavigationController alloc] initWithRootViewController: mainViewController];
    mainNavigationController.title = @"Main";
    [[mainNavigationController navigationBar] setBarStyle: UIBarStyleBlack];

    [tabBarController setViewControllers: [NSArray arrayWithObjects: mainNavigationController,  nil]];

    [self.window setRootViewController: tabBarController];
    [self.window makeKeyAndVisible];

    [mainViewController release];
    [mainNavigationController release];
    [tabBarController release];

    return YES;
}
最佳回答

问题在于,我包括“ID”Windows-(避免)sendEvent:Event *)event方法,但却是 t。 我呼吁这样做,一切都是固定的。

问题回答

edit: note that this response the original question, before a main rewrite changing the full issue

你们首先应当发现,是否有文件记载的方式(一些呼吁或压倒性的方法)来改变 bar的高度。 我非常怀疑。 我也怀疑,UIWindow 是寻找这一条的地方,而这种条码是UINavigationController的一部分。

假设没有任何法律途径迫使高压维持44px,你可以尝试以下几个方面:

  1. (not recommended) break the entire autorotation machinery of UINavigationController, handle the rotation of the view controllers yourself, e.g. from UIWindow, like you are starting to do now. The UINavigationController will only "feel" a resize and doesn t know it is actually rotating. The UINavigationController must not do rotations, so -shouldAutoRotate.. { return NO; }. As a quick check, see what happens if you would simply set the frame of the topmost VC to CGRectMake(0,0,480,320); (either from your subclassed UINavigationController or from the subclassed UIWindow). If everything still works OK, then you only need to add the autorotation part.
  2. (recommended) don t rely on UINavigationController for drawing navigation bars, but do it all yourself. Not much fun to do, but a 99% guarantee that you will get it working and it will not break on every update of iOS.
  3. (neutral, quick&dirty fix) for landscape mode, put your own UINavigationBar on top of the regular one.




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签