相关疑难解决方法(0)

如何在iphone导航栏上添加背景图片?

我想在导航栏中添加图像背景.

这样对吗?

//set custom background image
UIImageView *backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"NavigationBackground.png"]];
[self.navigationBar insertSubview:backgroundView atIndex:0];
[backgroundView release];
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch background uinavigationbar ios

32
推荐指数
5
解决办法
5万
查看次数

UINavigationBar圆了两个角落

我想围绕UINavigationBar的右上角和左上角.

我知道有更改视角半径的功能,但是可以做一些类似于标准UINavigationBar的操作吗?

如果您不知道我在说什么,请查看以下内容:

谢谢!

iphone cocoa-touch objective-c rounded-corners uinavigationbar

12
推荐指数
2
解决办法
6943
查看次数

iOS 5 UIView drawRect覆盖不在设备上工作

我正在准备我的iPhone应用程序在iOS 5 GM上发布,并遇到了UIView的错误.当我在子类上覆盖drawRect方法时,模拟器会显示所需的结果,但是当我尝试在实际设备上进行测试时,drawRect覆盖根本没有任何效果.

我甚至在drawRect覆盖中放置了一个日志语句,并确认它正在被调用.

有没有人注意到这个问题?

这是我正在使用的覆盖代码:

- (void)drawRect:(CGRect)rect {
DebugLog( @"*** calling drawRect ***" );

CGContextRef context = UIGraphicsGetCurrentContext(); 

// draw the dark gray background
CGContextSetFillColor(context, [SkinManager getWhiteColor]);
CGContextFillRect(context, CGRectMake(0.0, 0.0, rect.size.width, rect.size.height)); 

// draw the text field background in white
CGContextSetFillColor(context, [SkinManager getDarkGray]);
CGContextFillRect(context, CGRectMake(2.0, 2.0, rect.size.width - 4, rect.size.height - 4)); 
Run Code Online (Sandbox Code Playgroud)

}

这是生成颜色的代码

    +(const CGFloat*) getDarkGray {
        UIColor *color = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1];

        return [self getCGColor:color];
}

+(const CGFloat*) getCGColor: (UIColor*)color {
        CGColorRef colorref = [color …
Run Code Online (Sandbox Code Playgroud)

iphone uiview drawrect ios

6
推荐指数
1
解决办法
4640
查看次数

平面导航栏

我将如何创建一个如下所示的导航栏:

http://i.stack.imgur.com/bbaCz.png

它比默认条更扁平,标题内的阴影也显得不同.

iphone xcode

1
推荐指数
1
解决办法
3296
查看次数