首页 文章 精选 留言 我的

精选列表

搜索[GPU适配],共10000篇文章
优秀的个人博客,低调大师

ios7适配--navgationbar遮住下面view的处理

3 down vote favorite Have you guys stumbled up on this issue ? Basically in iOS 7 Navigation Controller is rendered over the sub-view I navigated to. In iOS 6 view I navigate to is enclosed between navigation bar and footer. In iOS 7 it looks like sub-view is rendered full-screen, under navigation bar and footer. As result user don't see it. Here is how I navigate to subview BRSMyListSubViewController*tagsInfoVC =[[BRSMyListSubViewController alloc] initWithCheckinsList:self.checkinsList selectedTag:[self tagByIndexPath:indexPath]];[self.navigationController pushViewController:tagsInfoVC animated:YES]; Here is how I initialize it inviewDidLoad self.navigationItem.leftBarButtonItem =[[UIBarButtonItem alloc] initWithTitle:@"Settings" style:UIBarButtonItemStyleBordered target:self action:@selector(settings:)]; self.navigationItem.rightBarButtonItem =[[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStyleBordered target:self action:@selector(logout:)]; For what it's worth I should also mention that sub-view is defined in XIB using Autolayout. Here is source of my XIB:http://pastebin.com/6RR0zYu4 And finally here is how it looks in iOS 6 And in iOS 7 Any thoughts ? ios cocoa-touch ios6 uinavigationcontroller ios7 share | edit | flag editedAug 29 at 18:47 asked Aug 29 at 4:09 ruslan 3,422 1 15 55 add comment 1 Answer active oldest votes up vote 5 down vote accepted Well, I figured it out. In your sub-view (BRSMyListSubViewControllerin my case), inviewDidLoad, you need to set one of these two self.edgesForExtendedLayout =UIRectEdgeNone; self.automaticallyAdjustsScrollViewInsets = NO; OR self.edgesForExtendedLayout =UIRectEdgeNone; self.extendedLayoutIncludesOpaqueBars = YES; Interestingly enough in root view controller these value are set to defaultUIRectEdgeAll,NOandYESrespectively but itstableViewis NOT under navbar and footer. I don't know why it's so illogical. It's also strange thatedgesForExtendedLayouthas to be mixed with one of two other properties even though it's clearly responsible for the behavior. share | edit | flag editedAug 29 at 6:11 answered Aug 29 at 5:29 ruslan 3,422 1 15 55 upvote flag Thank you for putting the answer, it really helped me.–titicacaSep 12 at 6:11 欢迎加群互相学习,共同进步。QQ群:iOS: 58099570 | Android: 572064792 | Nodejs:329118122 做人要厚道,转载请注明出处! 本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/sunshine-anycall/p/3338688.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

【移动开发】Android中强大的适配功能----Fragment(碎片)总结

作为大多数刚接触Android应用开发的人来说,在一个强大的Activity类中,就可以完成丰富多彩的UI工作,但是杂乱的屏幕分辨率,使得本来好不容易写好的UI,变得不堪入目。。。该怎么办那? 查阅了好多资料,才发现,原来我out了!早在Android在3.0版本就引入了Fragment(碎片)功能,它非常类似于Activity,可以像Activity一样包含布局,通过将Activity 的布局分散到frament 中,可以在运行时修改activity 的外观,并且由activity 管理的back stack 中保存些变化,很巧妙的解决了不同分辨率手机上UI差异变化的问题。总结一下吧! 一.Fragment介绍: 官方文档:http://developer.android.com/guide/components/fragments.html Fragment是我们在单个Activity上要切换多个UI界面时,要显示的不同内容。模块化这些UI面板可以提供给其他Acitivity来使用,因此我们可以简单地把Fragment看成类似于TextView控件一样,可以被任意的Activity进行加载。 1.静态加载: 首先,在Layout下建立两个xml fragment1.xml: 1 2 3 4 5 6 7 8 9 10 11 12 13 <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:layout_width = "match_parent" android:layout_height = "match_parent" android:orientation = "vertical" android:background = "#000000" > < TextView android:id = "@+id/textView1" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:text = "我是Fragment1" /> </ LinearLayout > fragment2.xml: 1 2 3 4 5 6 7 8 9 10 11 12 <? xml version = "1.0" encoding = "utf-8" ?> < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:layout_width = "match_parent" android:layout_height = "match_parent" android:orientation = "vertical" android:background = "#0000ff" > < TextView android:id = "@+id/textView1" android:layout_width = "wrap_content" android:layout_height = "wrap_content" android:text = "我是Fragment2" /> </ LinearLayout > 之后建立两个类: FragmentFirst类: 1 2 3 4 5 6 7 8 9 10 11 12 13 package com.zhf.android_fragmentdemo; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class FragmentFirst extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment1, container, false ); } } FragmentSecond类: 1 2 3 4 5 6 7 8 9 10 11 12 13 package com.zhf.android_fragmentdemo; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class FragmentSecond extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.fragment2, container, false ); } } 最后一步就是在activity_main.xml中应用这两个布局文件: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 <LinearLayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "match_parent" android:layout_height= "match_parent" android:orientation= "horizontal" > <fragment android:id= "@+id/fragment1" android:name= "com.zhf.android_fragmentdemo.FragmentSecond" android:layout_width= "0dip" android:layout_height= "match_parent" android:layout_weight= "1" /> <fragment android:id= "@+id/fragment2" android:name= "com.zhf.android_fragmentdemo.FragmentFirst" android:layout_width= "0dip" android:layout_height= "match_parent" android:layout_weight= "1" /> </LinearLayout> 主类MainActivity中不用添加其他代码,直接加载activity_main.xml即可。 效果图: ok!简单三步就将fragment加载进去了,当然这只是fragment的一小部分功能,它的强大之处其实在于:Activity能够根据自身情况来动态的加载fragemnt,使你的UI界面变得更加多样可变! 2.动态加载:(重点) 首先,现将activity_main.xml中多余部分去掉: 1 2 3 4 5 6 < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" android:id = "@+id/main_layout" android:layout_width = "match_parent" android:layout_height = "match_parent" android:orientation = "horizontal" > </ LinearLayout > 其次,就是在MainActivity类中动态添加这两个Fragment类: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 package com.zhf.android_fragmentdemo; import android.app.Activity; import android.os.Bundle; import android.view.Display; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); setContentView(R.layout.activity_main2); Display display = getWindowManager().getDefaultDisplay(); if (display.getWidth() > display.getHeight()) { FragmentFirst fragmentFirst = new FragmentFirst(); getFragmentManager().beginTransaction() .replace(R.id.main_layout, fragmentFirst).commit(); } else { FragmentSecond fragmentSecond = new FragmentSecond(); getFragmentManager().beginTransaction() .replace(R.id.main_layout, fragmentSecond).commit(); } } } 运行一下,效果出来了,为了体现出动态,大家可以试着把手机自动转屏打开,转一下屏试试! ----转屏之后---> 注:动态加载过程步骤 1.获取到FragmentManager,在Activity中可以直接通过getFragmentManager得到。 2.调用beginTransaction方法开启一个事务。 3.向容器内加入Fragment,一般使用replace方法实现,需要传入容器的id和Fragment的实例。 4.提交事务,调用commit方法提交。 介绍完这两种方式,大家是不是已经对其有了一些感性的认识,这里注意一下Fragment是在3.0版本引入的,如果你使用的是3.0之前的系统,需要先导入android-support-v4的jar包才能使用Fragment功能,这里可能需要继承FragmengActivity(现在建立低版本项目时,ADT会自动将libs下的android-support-v4.jar构建到项目路径) 接下来我们具体挖掘一下生命周期及其Fragment中一些主要方法的介绍! 二.Fragment类的生命周期 复写fragment中的方法,测试一下它的生命周期看看它与Activity的异同。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 package com.zhf.android_fragmentdemo; import android.app.Activity; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /** * Fragment的生命周期 * 注意: 方法中的排列次序即为fragment全过程:启动时方法调用次序 + 退出时方法调用次序 * @author ZHF * */ public class FragmentFirst extends Fragment { /**Fragment和Activity建立关联的时候调用**/ @Override public void onAttach(Activity activity) { super .onAttach(activity); System.out.println( "onAttach" ); } @Override public void onCreate(Bundle savedInstanceState) { super .onCreate(savedInstanceState); System.out.println( "onCreate" ); } /**为Fragment加载布局时调用**/ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { System.out.println( "onCreateView" ); return inflater.inflate(R.layout.fragment1, container, false ); } /**当Activity中的onCreate方法执行完后调用**/ @Override public void onActivityCreated(Bundle savedInstanceState) { super .onActivityCreated(savedInstanceState); System.out.println( "onActivityCreated" ); } @Override public void onStart() { super .onStart(); System.out.println( "onStart" ); } @Override public void onResume() { super .onResume(); System.out.println( "onResume" ); } @Override public void onPause() { super .onPause(); System.out.println( "onPause" ); } @Override public void onStop() { super .onStop(); System.out.println( "onStop" ); } /**Fragment中的布局被移除时调用**/ @Override public void onDestroyView() { super .onDestroyView(); System.out.println( "onDestroyView" ); } @Override public void onDestroy() { super .onDestroy(); System.out.println( "onDestroy" ); } /**Fragment和Activity解除关联的时候调用**/ @Override public void onDetach() { super .onDetach(); System.out.println( "onDetach" ); } } 打印结果: 1.运行一下: 2.返回退出: 3.Home键退出: 4.再次进入: 通过打印的结果,我们应该可以清楚的了解到其实fragment和Activity的生命周期还是很相似的 (Activity生命周期博客:http://smallwoniu.blog.51cto.com/blog/3911954/1246732) 官网截图: 三.Fragment中有几个重要的回调方法 方法 描述 onAttach() Fragment和Activity建立关联的时候调用 onCreateView() 为Fragment加载布局时调用 onActivityCreated() 当Activity中的onCreate方法执行完后调用 onDestroyView() Fragment中的布局被移除时调用 onDetach() Fragment和Activity解除关联的时候调用 只有掌握了Fragment中这几个重要的方法,在使用的过程中才能更加灵活的与Activity配套使用,动态加载以适应不同屏幕分辨率的状况! ok! 因为本人也是刚接触Fragment时间不长,这里也是查阅了许多的资料,简单总结了一番,方便以后查阅,希望能帮助到刚接触fragment的人。 在下一篇博客中我会使用Fragment+ViewPager写一个动态加载数据库的综合的案例,欢迎大家查阅! 附件:http://down.51cto.com/data/2363603 本文转自zhf651555765 51CTO博客,原文链接:http://blog.51cto.com/smallwoniu/1308365,如需转载请自行联系原作者

优秀的个人博客,低调大师

Windows 10 “杀手级应用” 将适配安卓和 iPhone

去年微软在Windows 10系统中推出了Windows Hello功能,有了这一功能,Windows 10设备可以通过移动设备来进行解锁并登陆系统,解锁过程完全不需要手动输入任何密码。 不过,这项功能有个极大的弊端,就是它只支持微软手机来登陆电脑操作系统。而现在,微软似乎意识到了这一点,Windows Hello将支持拥有更大用户基数的Android手机和iPhone。 根据微软此前的介绍,Windows Hello支持面部、虹膜或指纹等生物特征来解锁,因为同时整合了上述多种生物识别技术,Windows Hello比普通的密码输入更加安全、便捷。 微软高级项目经理 Anoosh Saboori表示,“人们无时无刻不携带移动设备,我们可以利用它们提高系统的安全性。” Anoosh Saboori向外界透露,Android手机和iPhone未来都会支持Windows Hello功能。“对于iPhone我们还有一些别的计划,但实现手机登陆电脑操作系统是马上要开展的一项。”所以,未来我们手中的手机都可以实现 Hello身份识别功能。 当然,微软推出Windows Hello的目不只是用来登入PC设备,这一功能已经得到了谷歌、联想、三星和高通等企业的支持,未来微软会在应用、服务、网站等方面全部开启Windows Hello功能。 据了解,除了Windows Hello功能,微软还试图通过其它方式来加强Windows 10系统的安全性,例如,当配对设备(手环、智能手表、手机等)移动到Windows 10电脑的接收范围外时,电脑就会自动锁定。 不过,微软官方没有透露何时能实现这些功能,有业内人士表示,2017年春天微软将发布Windows 10的路线图中的下一步计划Redstone 2,届时可能会有更多的相关信息公布。 文章转载自 开源中国社区 [http://www.oschina.net]

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册