当前位置: 编程技术>移动开发
本页文章导读:
▪UINavigationBar自定义导航栏背景跟按钮 UINavigationBar自定义导航栏背景和按钮
UINavigationBar自定义导航栏背景和按钮,完美支持横屏竖屏旋转,视图控制器可以分别使用自己的导航栏
此方法可以通过Apple审核,导航上的按钮背景需.........
▪ Nokia MeeGo Qt 批改ToolBarLayout的颜色 Nokia MeeGo Qt 修改ToolBarLayout的颜色
ToolBarLayout的颜色默认是灰白色。
如何变成系统设置那种黑色呢?
很简单
在pageStackWindow下加上这个就行:
Component.onCompleted: {
console.log("Loaded")
.........
▪ Toast的容易使用 Toast的简单使用
[img]http://dl.iteye.com/upload/attachment/547097/43fe21be-98f8-369b-ab62-5fb39da867dc.jpg" alt="[/img]
import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import androi.........
[1]UINavigationBar自定义导航栏背景跟按钮
来源: 互联网 发布时间: 2014-02-18
UINavigationBar自定义导航栏背景和按钮
//CustomNavigationBar.h
@interface UINavigationBar (UINavigationBarCategory)
UIImageView *backgroundView;
- (void)setBackgroundImage:(UIImage*)image;
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index;
@end
//CustomNavigationBar.m
@implementation UINavigationBar (UINavigationBarCategory)
-(void)setBackgroundImage:(UIImage*)image
{
if(image == nil)
{
[backgroundView removeFromSuperview];
}
else
{
backgroundView = [[UIImageView alloc] initWithImage:image];
backgroundView.tag = 1;
backgroundView.frame = CGRectMake(0.f, 0.f, self.frame.size.width, self.frame.size.height);
backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self addSubview:backgroundView];
[self sendSubviewToBack:backgroundView];
[backgroundView release];
}
}
//for other views
- (void)insertSubview:(UIView *)view atIndex:(NSInteger)index
{
[super insertSubview:view atIndex:index];
[self sendSubviewToBack:backgroundView];
}
@end
//YourViewController.m
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
[self.navigationController.navigationBar
setBackgroundImage:[UIImage imageNamed:@"navigation_bar_bg.png"]];
}
UINavigationBar自定义导航栏背景和按钮,完美支持横屏竖屏旋转,视图控制器可以分别使用自己的导航栏
此方法可以通过Apple审核,导航上的按钮背景需要做,否则看起来不那么和之又谐
Objective-c代码
[2] Nokia MeeGo Qt 批改ToolBarLayout的颜色
来源: 互联网 发布时间: 2014-02-18
Nokia MeeGo Qt 修改ToolBarLayout的颜色
ToolBarLayout的颜色默认是灰白色。
如何变成系统设置那种黑色呢?
很简单
在pageStackWindow下加上这个就行:
Component.onCompleted: {
console.log("Loaded")
theme.inverted = true
}
就是将程序的主题反相
[3] Toast的容易使用
来源: 互联网 发布时间: 2014-02-18
Toast的简单使用
[img]http://dl.iteye.com/upload/attachment/547097/43fe21be-98f8-369b-ab62-5fb39da867dc.jpg" alt="[/img]
[img]http://dl.iteye.com/upload/attachment/547097/43fe21be-98f8-369b-ab62-5fb39da867dc.jpg" alt="[/img]
import android.app.Activity;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
/**
* Toast的使用
*
*/
public class ActivityMain extends Activity {
private Button mButton;
private EditText mEditText;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mButton =(Button) findViewById(R.id.myButton);
mEditText = (EditText) findViewById(R.id.myEditText);
mButton.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
Editable Str = mEditText.getText();
//使用系统标准的makeText()方式来产生Toast信息
Toast.makeText(ActivityMain.this, "你的汇报 "+Str.toString() + "已发送到老婆大人的邮箱!", Toast.LENGTH_LONG).show();
//清空EditText
mEditText.setText("");
}
});
}
}
最新技术文章: