小编nac*_*tel的帖子

如何辨别用户手机铃声是关闭还是开启?使用swift

我用什么代码来确定用户iPhone铃声是打开还是关闭?

我正在制作的应用程序,在后台播放音乐,如果iphone铃声开关关闭,那么我希望音乐停止播放.

我的问题与此类似,但我想在swift和IOS8中得到答案......

在iOS 7中检测静音模式

码:

if iphoneRinger == On {
  self.playmusic()
}
else {
  self.stopmusic()
}
Run Code Online (Sandbox Code Playgroud)

iphone ios swift ios8

7
推荐指数
0
解决办法
1095
查看次数

如何添加此共享按钮?IOS8用迅捷

我希望我的应用程序中有一个按钮,当按下它时,会弹出这个(见下图).我怎么做?我不想创建自定义共享extion,我只想要默认的一个?我用什么代码?所有在线教程都是客观的.请迅速给出答案.

图片:http://9to5mac.com/2014/06/30/hands-on-1password-beta-shows-off-ios-8s-touch-id-extensions-apis-video/#jp-carousel-330420

到目前为止,这是我的代码,但是我得到一个错误,UIBarButtonItem不能为UIVIew提供什么?该操作是否连接到导航栏按钮项?

@IBAction func ActionButton(sender: UIBarButtonItem) {

    let firstActivityItem = "Text you want"
    let secondActivityItem : NSURL = NSURL(string: "http//:urlyouwant")!
    // If you want to put an image
    let image : UIImage = UIImage(named: "TALogo")!

    let activityViewController : UIActivityViewController = UIActivityViewController(
        activityItems: [firstActivityItem, secondActivityItem, image], applicationActivities: nil)

    // This lines is for the popover you need to show in iPad
    activityViewController.popoverPresentationController?.sourceView = (sender as! UIBarButtonItem)

    // This line remove the arrow of the popover to show in iPad …
Run Code Online (Sandbox Code Playgroud)

iphone sharing swift ios8 ios-extensions

3
推荐指数
1
解决办法
8332
查看次数

标签 统计

ios8 ×2

iphone ×2

swift ×2

ios ×1

ios-extensions ×1

sharing ×1