在我的iphone应用程序中,我添加了Uitable视图.在启动应用程序时,表格显示了我想要的行数.现在我想将导航栏添加到UiTable,我也想在导航栏的左侧添加编辑按钮.
如何在iPhone的UiTable视图中添加导航栏?我不想使用基于UiNavigation的应用程序.我想使用代码添加.如果任何人有任何有用的代码或任何其他有用的链接或其他解决方案,将不胜感激.请你需要.
升级到iOS 5和Xcode 4.2后出现一些设计问题
这就是我在iOS 4中查看的视图:
这就是它在iOS 5中的样子:
在我的导航委托中,我有以下方法在顶部绘制"图像":
- (void)drawRect:(CGRect)rect {
UIImage *image;
if(self.barStyle == UIBarStyleDefault){
image = [UIImage imageNamed: @"topbar_base.png"];
}
else{
image = [UIImage imageNamed: @"nyhedsbar_base.png"];
}
[image drawInRect:CGRectMake(-1, -1, self.frame.size.width+3, self.frame.size.height+3)];
}
Run Code Online (Sandbox Code Playgroud)
在我的控制器内部,我设置了以下内容:
self.navigationBarStyle = UIBarStyleBlack;
Run Code Online (Sandbox Code Playgroud)
怎么会在iOS 5中不起作用?
谢谢
我试图隐藏导航栏,使用我在互联网上描述的方法.
我有一个简单的布局,显示WebView:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:id="@+id/layout" >
<WebView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
我在app启动时使用的代码是:
getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
web.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
layout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
Run Code Online (Sandbox Code Playgroud)
但这并不掩盖导航栏.
我已经添加...
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
Run Code Online (Sandbox Code Playgroud)
......也参加了我的活动.
我怎样才能做到这一点?
我使用CSS和HTML创建了一个下拉菜单.
我想要的是当我将鼠标悬停在子菜单链接上时导航菜单项会变回蓝色.例如,当我将鼠标悬停在Resources1 标题下的Resources标题上时,我希望Resources字体更改回蓝色.
JSFiddle:http://jsfiddle.net/SSL78/
有人可以建议我如何使用CSS做到这一点?
我在导航栏上添加了两个自定义按钮。一个在左边,另一个在右边。我已经成功完成了
但是我未能减小按钮的起点和框架之间的距离。
我做了很多尝试,还给了x的负值,但还是没有帮助。这是按钮的代码
-(void)addLeftButton
{
UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom];
aButton.backgroundColor = [UIColor redColor];
[aButton setTitle:@"H" forState:UIControlStateNormal];
aButton.frame = CGRectMake(0.0, 0.0, 40, 40);
[aButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
UIBarButtonItem *aBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:aButton];
[aButton addTarget:self action:@selector(backBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.navigationItem setLeftBarButtonItem:aBarButtonItem];
}
-(void)addRightButton
{
UIButton *aButton = [UIButton buttonWithType:UIButtonTypeCustom];
aButton.backgroundColor = [UIColor greenColor];
[aButton setTitle:@"B" forState:UIControlStateNormal];
aButton.frame = CGRectMake(0.0, 0.0, 40, 40);
[aButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
UIBarButtonItem *aBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:aButton];
[aButton addTarget:self action:@selector(backBtnClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.navigationItem setRightBarButtonItem:aBarButtonItem];
}
Run Code Online (Sandbox Code Playgroud)
也尝试使用
aBarButtonItem.width = …Run Code Online (Sandbox Code Playgroud) 我创建了一个表视图,用户可以通过单击导航栏中的"添加"按钮来添加行.当用户选择一行时,应用程序会显示另一个表视图.我想将导航栏的标题设置为所选行的名称.
我知道如果我在第二个表视图中将名称传递给标签,如何设置导航栏的标题.
title = self.restaurant.name
Run Code Online (Sandbox Code Playgroud)
但我还没弄明白如何在不创建额外标签的情况下将其传递到导航栏.
以下代码旨在每次用户点击屏幕时切换导航栏可见性.除了一种情况外它工作得很好 - 非常快速点击屏幕.在某些情况下,当用户点击非常快时,导航栏会在onClick触发事件时保持在屏幕上.
这是MainActivity的代码:
package com.example.ui_test;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.RelativeLayout;
public class MainActivity extends Activity {
private final String DEBUG_TAG = "UI TEST";
int uiOptions = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
RelativeLayout r = (RelativeLayout) findViewById(R.id.main_layout);
r.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
toggleUiVisibility();
}
});
View decorView = getWindow().getDecorView();
decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
@Override
public void onSystemUiVisibilityChange(int visibility) {
Log.d(DEBUG_TAG, "Visibility changed. New …Run Code Online (Sandbox Code Playgroud) 我想更改视图的导航标题,该标题与选项卡栏控制器相关,后者与导航控制器相关(参见图片)
我不知道该怎么做.
在基本视图中,我只需要在ViewController.swift中执行此操作:self.title="test"
但是在这里,这一行更改了标签栏的标题,但我想更改导航的标题.
我试图用html css创建一个简单的页面,但开始面对导航栏的问题.我放了一个透明的盒子,里面有一些文字.但是当页面滚动时,框会在菜单上方悬停.找到一个相关的主题"菜单重叠身体",但没有看到任何解决我的问题.[ DEMO ]
<head>
div.box {
margin: 30px;
background-color: #333;
border: 1px solid black;
opacity: 0.6;
font-size: 20px;
filter: alpha(opacity=60); /* For IE8 and earlier */
}
div.box p {
margin: 5%;
font-weight: normal;
color: #ffffff;
}
.navbar {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.navbar a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
}
.navbar a:hover {
background: #ddd;
color: black;
}
<div class="navbar" …Run Code Online (Sandbox Code Playgroud) navigationbar ×10
ios ×4
android ×2
css ×2
html ×2
iphone ×2
uitableview ×2
android-4.0-ice-cream-sandwich ×1
coding-style ×1
overlapping ×1
swift ×1
swift2 ×1
tablet ×1
title ×1
xcode ×1
xcode7 ×1