使用目标c在图像视图上方添加透明视图

时间:2015-06-24 06:54:06

标签: ios objective-c iphone

我有一个UIImageView。我想添加一个trans

 inCallBackGroundImgae = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"caller_texture.png"]];
        [inCallBackGroundImgae setFrame:CGRectMake(0,top, self.view.frame.size.width, 250)];
        [self.view addSubview: inCallBackGroundImgae];

enter image description here

我想添加一个透明视图,我在其中添加一个红色enter image description here。我不想要导航栏我想添加透明视图

提前致谢

2 个答案:

答案 0 :(得分:0)

请做这个

<application
    android:name=".XXXXXX"
    android:allowBackup="true"

    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/app_theme" > //here

答案 1 :(得分:0)

hide navigation bar

中首先viewDidLoad method这样
[self.navigationController.navigationBar setHidden:YES];

现在添加透明UIView代替navigationBar

UIView *transparentView = [[UIView alloc] initWithFrame:CGRectMake(0,0, self.view.frame.size.width, 64)];
transparentView.alpha = 0.33f;
[self.view addSubview: transparentView];

编辑:调整图像视图框,因为无法看到透明视图。

CGRect imgViewRect = inCallBackGroundImgae.frame;
imgViewRect.origin.y = 64;
imgViewRect.size.height = decrease height here if necessary
inCallBackGroundImgae.frame = imgViewRect;