所谓“果冻效果”,指的是到了顶部或者底部后,还能再拉一截那个效果。
tableView.bounces = false
[......]
Author Archives: coder4
ios如何让启动页(闪屏页)强制竖屏,而进入App后允许横屏和竖屏
1、修改App-info.plist(在XCode中General中设置 一样的效果)
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
2、AppDelegate中:
- (UIInterfaceOrientationMask)appl[......]
ios强制设定旋转
UIDevice.current.setValue(UIDeviceOrientation.portrait.rawValue, forKey: "orientation")
需要指出的是,如果当前vc是autoRotatefalse,且只支持竖屏,那么present一个支持旋转的vc后,再返回,是可能会出现一个横屏的状态的,感觉是个ios 的bug,所以才在外面dismiss时候调了这么一下。。。[......]
XCode8之后,闪屏如何不用storyboard继续用静态图
在XCode 8 之后,可以用sb做启动闪屏图了。
但是storyboard有很多限制是没法实现的,所以很多时候还是喜欢用静态图。
操作方法 转载自:《【iOS开发】使用XCode 8添加Launch Image(启动图片)》
一、Assets.xcassets -》 + -》 App icons & Launch Images -》 New iOS Launch Image
需要说明的是:一定要对所有尺寸都设置好图,否则对应尺寸的设备 进入app后,分[......]
iOS中自定义UIView如何更改子view的布局
autolayout不说了,看下frame布局的情况。
我们假设subview永远和当前view尺寸一样。则:
class YourView: UIView {
.....
override func layoutSubviews() {
super.layoutSubviews()
let frame1 = CGRect(x: 0, y: 0, width: frame.width, height: frame.height)[......]
