Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 左巴布托主义从画面中走出来_Ios - Fatal编程技术网

Ios 左巴布托主义从画面中走出来

Ios 左巴布托主义从画面中走出来,ios,Ios,我已经应用了一个代码将uibutton添加到UIBarButtonim中,问题是该按钮超出了框架 代码是 a1 = [UIButton buttonWithType:UIButtonTypeCustom]; [a1 setFrame:CGRectMake(0.0f, 0.0f, 65.0f, 63.0f)]; [a1 addTarget:self.slideMenuController action:@selector(toggleMenu) forControl

我已经应用了一个代码将uibutton添加到UIBarButtonim中,问题是该按钮超出了框架

代码是

        a1 = [UIButton buttonWithType:UIButtonTypeCustom];
    [a1 setFrame:CGRectMake(0.0f, 0.0f, 65.0f, 63.0f)];
    [a1 addTarget:self.slideMenuController action:@selector(toggleMenu) forControlEvents:UIControlEventTouchUpInside];
    [a1 setImage:[UIImage imageNamed:@"menu-enable-bt.png"] forState:UIControlStateNormal];

    UIView *view =[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 65.0,63.0) ];
    [view addSubview:a1];

    menuButton = [[UIBarButtonItem alloc] initWithCustomView:view];


    rootViewController.navigationItem.leftBarButtonItem = menuButton;
我不知道怎么了试试这个

 a1 = [UIButton buttonWithType:UIButtonTypeCustom];
    [a1 setFrame:CGRectMake(0.0f, 0.0f, 30.0f, 30.0f)];
    [a1 addTarget:self.slideMenuController action:@selector(toggleMenu) forControlEvents:UIControlEventTouchUpInside];
    [a1 setImage:[UIImage imageNamed:@"menu-enable-bt.png"] forState:UIControlStateNormal];

    UIView *view =[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 35.0,35.0) ];
    [view addSubview:a1];

    menuButton = [[UIBarButtonItem alloc] initWithCustomView:view];


    rootViewController.navigationItem.leftBarButtonItem = menuButton;

UINavigationBar
高度为44,设置帧(0.0,0.0,65.0,63.0),更改帧高度以适应
UINavigationBar

您是否尝试降低
cDirectMake(0.0,0.0,65.0,63.0)中的高度?是的,您可能正在泄漏
视图
菜单按钮

也代替-

a1 = [UIButton buttonWithType:UIButtonTypeCustom];
    [a1 setFrame:CGRectMake(0.0f, 0.0f, 65.0f, 63.0f)];
    [a1 addTarget:self.slideMenuController action:@selector(toggleMenu) forControlEvents:UIControlEventTouchUpInside];
    [a1 setImage:[UIImage imageNamed:@"menu-enable-bt.png"] forState:UIControlStateNormal];

    UIView *view =[[UIView alloc] initWithFrame:CGRectMake(0.0, 0.0, 65.0,63.0) ];
    [view addSubview:a1];

    menuButton = [[UIBarButtonItem alloc] initWithCustomView:view];
您只需在CustomView:a1中提供
menuButton=[[uibarbuttonim alloc]init然后-

rootViewController.navigationItem.leftBarButtonItem = menuButton;

[menuButton release];
像这样试试

UIButton * a1 = [UIButton buttonWithType:UIButtonTypeCustom];
    [a1 setFrame:CGRectMake(0.0f, 0.0f, 65.0f, 33.0f)];
    [a1 addTarget:nil action:nil forControlEvents:UIControlEventTouchUpInside];
    [a1 setImage:[UIImage imageNamed:@"sc.png"] forState:UIControlStateNormal];


   UIBarButtonItem* menuButton = [[UIBarButtonItem alloc] initWithCustomView:a1];


    self.navigationItem.leftBarButtonItem = menuButton;

你有没有试着降低CGRectMake(0.0,0.0,65.0,63.0)中的高度?
?我知道在这里这样说不合适,但我真的很喜欢它现在的样子:)让我知道有关这方面的任何问题?这样做了,但没有用。。问题仍然是一样的