我正在coreMotion我的应用程序中使用来检测iOS设备的动作.我知道如何从中获取不同的传感器数据coreMotion.我得到的滚动,俯仰和偏航数据如下deviceMotion:
float pitch = (180/M_PI)*self.manager.deviceMotion.attitude.pitch];
float roll = (180/M_PI)*self.manager.deviceMotion.attitude.roll];
float yaw = (180/M_PI)*self.manager.deviceMotion.attitude.yaw];
Run Code Online (Sandbox Code Playgroud)
如何使用这些数据来检测运动?我需要为此做些什么计算?
为了在全视图中提供交互弹出手势,我的控制器中有一个 UIPanGestureRecognizer,我们可以使用它从左向右滑动视图控制器中的任何位置来弹出控制器,而不是使用默认的 NavigationController 弹出手势。
当我在视图中使用键盘打开的手势时,键盘也会通过交互解除(默认 NavigationController 弹出手势不发生),这看起来很奇怪。
func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationControllerOperation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
if operation == .pop {
return PopControllerTransition()//My transition
}
return nil
}
Run Code Online (Sandbox Code Playgroud)
如何在使用自定义弹出转换弹出 viewController 时防止键盘关闭。
//transition code
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
let containerView = transitionContext.containerView
let fromController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.from)!
let toController = transitionContext.viewController(forKey: UITransitionContextViewControllerKey.to)!
toController.view.transform = CGAffineTransform(translationX: -(toController.view.bounds.width/3), y: 0)
containerView.insertSubview(toController.view, belowSubview: fromController.view)
let view = GradientView(frame: containerView.frame)
view.horizontal = true
view.backgroundColor = UIColor.clear
view.transform …Run Code Online (Sandbox Code Playgroud) uinavigationcontroller popviewcontroller ios popviewcontrolleranimated swift
我正在开发一个应用程序,需要在1小时内将imageview的宽度从320减少到0.为此,我使用以下代码
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:3600];
newRect.size.width = 0;
imgView.frame = newRect;
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
如果我们停留在相同的视图控制器中,如果用户导航到其他一个viewcontoller,如何处理动画,则动画启动后,它可以正常工作.
除此之外我还有一个问题 - 在动画期间,imageview中的图像看起来像整个动画中缩小我正在使用相同的图像,所以我想在动画期间更改imageView中的图像我该如何实现这一点.
除了动画之外还有其他任何方法吗?
任何帮助都会得到赞赏.
我正在使用MPMoviePlayerController播放来自url的视频。为此,我从Xml parser.this得到链接。
NSString *path=[[self.items objectAtIndex:videoIndex]objectForKey:@"link"];
Run Code Online (Sandbox Code Playgroud)
我正在将该路径分配给NSURL fileWithPath,如下所示。
NSURL *mediaUrl = [NSURL fileURLWithPath:path];
Run Code Online (Sandbox Code Playgroud)
在打印mediaUrl时,NSLog给出“ http : //example.com-file:// localhost /”
为什么将-file:// localhost /附加到URL,因为此视频没有显示。任何帮助请。谢谢。
我需要在两个"%"字符之间提取字符串,查询字符串中可能出现多个匹配项.现在使用以下正则表达式,有人可以帮助获得确切的Regax格式.
let query = "Hello %test% ho do you do %test1%"
let regex = try! NSRegularExpression(pattern:"%(.*?)%", options: [])
if let results = regex?.matchesInString(query, options: .Anchored, range: NSMakeRange(0,query.characters.count)){
for match in results{
}
}
Run Code Online (Sandbox Code Playgroud) 我在我的应用程序中使用iCarousel,我需要获取iCarousel的当前索引并在标签(self.view的子视图)中显示该索引,该标签不是iCarousel的子视图.我能够获得当前索引
int index=iCarousel.currentIndex;
Run Code Online (Sandbox Code Playgroud)
如何在每次轮播轮播时更新label.text中的索引.我必须在哪种方法中编写代码来更新标签.
我正在使用Xcode 5.0,我将JSON库文件复制到我的项目中,这些文件是用非弧构建的,所以我为这些JSON库编译器源添加了编译器标志"fno-objc-arc".这样做后我得到苹果LLVM 5.o错误.
clang: error: no such file or directory: 'fno-objc-arc'
Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang failed with exit code 1
Run Code Online (Sandbox Code Playgroud)
请帮我解决这个错误.
ios ×7
iphone ×2
swift ×2
animation ×1
core-motion ×1
llvm-clang ×1
nsurl ×1
objective-c ×1
regex ×1
uiimageview ×1
uiscrollview ×1
uiview ×1