ios 怎样让subview在最上层显示

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ios 怎样让subview在最上层显示相关的知识,希望对你有一定的参考价值。

参考技术A   [self.view bringSubviewToFront:Btn]; 参考技术B _parentView = nil;

NSArray* windows = [UIApplication sharedApplication].windows;
_window = [windows objectAtIndex:0];
//keep the first subview
if(_window.subviews.count > 0)
_parentView = [_window.subviews objectAtIndex:0];

java中怎样让一个JFrame窗体始终在最前端显示?

最好能给例子,谢谢!

Window类中有一个方法是setAlwaysOnTop.这个方法就是让窗口总是保持在最前端的!而JFrame又是继承Window类了,因此也可以用这个方法!
可以这样调用:
JFrame frame=new JFrame();
frame.setAlwaysOnTop(true);
参考技术A import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import java.net.*;
import java.awt.color.*;
import java.util.Vector;
public class Login extends JFrame
implements ActionListener

int port=3000;
static Vector v=new Vector();
private JLabel qqid;
private JLabel qqpwd;
private JTextField use;
private JPasswordField pwd;
private JButton login;
private JButton reg;
private JButton canel;
private JLabel imageLabel;
private Icon image;
JPanel pane;
public Login(String str)
super(str);
int screenWidth = (int)java.awt.Toolkit.getDefaultToolkit().getScreenSize().width;
int screenHeight = (int)java.awt.Toolkit.getDefaultToolkit().getScreenSize().height;
image=new ImageIcon("picture\\科比.png");
imageLabel=new JLabel(image);
imageLabel.setBounds(0,0,230,75);
this.add(imageLabel);
qqid=new JLabel("QQ号码:");
qqpwd=new JLabel("QQ密码:");
use=new JTextField();
pwd=new JPasswordField('*');
login=new JButton("登录");
reg=new JButton("注册");
canel=new JButton(" 取消");
pane=new JPanel();
pane.setLayout(null);
pane.add(qqid);
pane.add(use);
pane.add(qqpwd);
pane.add(pwd);
pane.add(canel);
pane.add(login);
pane.add(reg);
qqid.setBounds(15,80,150,20);
use.setBounds(65,80,150,20);
qqpwd.setBounds(15,115,150,20);
pwd.setBounds(65,115,150,20);
login.setBounds(10,160,60,20);
canel.setBounds(80,160,65,20);
reg.setBounds(160,160,60,20);
this.getContentPane().add(pane).setBackground(Color.white);
this.getContentPane().add(pane);
login.addActionListener(this);
reg.addActionListener(this);
canel.addActionListener(this);
this.setResizable(false);
this.setSize(245,240);
this.setLocation((screenWidth-245)/2, (screenHeight-240)/2);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
this.setVisible(true);

public void actionPerformed(ActionEvent e)
JButton jb=(JButton)e.getSource();
if(jb==login)
Talk talk=new Talk();
DatagramPacket dp=null;
try
talk.sendMSG("登录"+":"+use.getText().trim()+":"+pwd.getText().trim()+":"+port,"127.0.0.1",3001);
dp=talk.getMsg(port);

catch(Exception ex)

String re=new String(dp.getData(),0,dp.getData().length);
if(re.trim().equals("success"))

this.setVisible(false);
new Chat(use.getText().trim(),"127.0.0.1","port");


else
JOptionPane.showMessageDialog(pane,"登录失败 请重新登录","错误",JOptionPane.INFORMATION_MESSAGE);
else if(jb==canel)
this.setVisible(false);

else if(jb==reg)
new Reg();


public static void main(String args[])
new Login("J_QQ用户登录界面");
参考技术B Jframe.setAlwaysOnTop(boolean b)可以设置是否前端显示。本回答被提问者和网友采纳

以上是关于ios 怎样让subview在最上层显示的主要内容,如果未能解决你的问题,请参考以下文章

如何让PopupWindow显示在Dialog之上,我说的之上是指上层

win7弹出的消息被其他页面遮挡,怎样让弹出的对话框显示在最上面一层?

wpf 界面中放了listbox想让他在最上层显示出来。

C#把动态创建的多个控件中指定控件显示在最上层

layui怎么让from表单设置在最靠前呢?处于最上层,不被其他遮挡

怎样让页面的 footer 始终在最底部