小编Wal*_*est的帖子

NotificationCompat android - 如何只显示大图标而不是小

当我添加通知时:

        NotificationCompat.Builder mBuilder =
                            new NotificationCompat.Builder(this)  
              .setSmallIcon(R.drawable.plus)
.setContentTitle(title)
.setAutoCancel(true) 
.setContentText(text)
.setSound(RingtoneManager .getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))
.setLargeIcon(bm);
Run Code Online (Sandbox Code Playgroud)

我看到大图标和小图标: 在此输入图像描述

如何只设置大图标,不小.如果只使用setLargeIcon,我根本看不到通知,只是声音警报.

notifications android

12
推荐指数
2
解决办法
1万
查看次数

如何在swift中更改标签栏未选中图标的颜色?

如何更改标签栏未选择的图标和文字的颜色?我找到了这个答案(如何更改标签栏上的非活动图标/文本颜色?),但无法为swift实现它.

uitabbaritem ios swift

8
推荐指数
4
解决办法
1万
查看次数

如何在swift中比较颜色

我想改变不同状态的按钮背景.我试试这样:

 @IBAction func addToShedulerAction(sender: UIButton) {   
       println(sender.backgroundColor)     
        if sender.backgroundColor==UIColor.redColor(){
            sender.backgroundColor==UIColor.whiteColor()
        }
        else //if sender.backgroundColor==UIColor.whiteColor()
        {
            sender.backgroundColor=UIColor.redColor()
        }
    }
Run Code Online (Sandbox Code Playgroud)

但在第一个按钮println打印nil和背景变为红色,在第二次打印println打印"可选(UIDeviceRGBColorSpace 1 0 0 1)"和颜色不会改变

ios swift

4
推荐指数
2
解决办法
6669
查看次数

如何启用移动但禁用UITableView中某些行的删除

我的UITableView中的某些行需要删除并在编辑模式下移动,但有些行只是移动.在这种方法中,我可以启用或禁用某些行的编辑

override func tableView(tableView: UITableView, canEditRowAtIndexPath indexPath: NSIndexPath) -> Bool{
            return true
    }
Run Code Online (Sandbox Code Playgroud)

但是如何在启用移动的情况下禁用某些行的删除?

uitableview ios swift

4
推荐指数
1
解决办法
1162
查看次数

查看背景颜色和按钮图像具有相同的代码但外观不同(iOS)

我通过故事板为UIView设置了背景颜色,但我在模拟器中看到了更亮的颜色.它与Button图像背景不同,代码相同,草图使用相同的代码.阿尔法设置1.什么可能是错的?

uiview ios

4
推荐指数
1
解决办法
800
查看次数

如何在Android 4.4中的onActivityResult中获取文件路径

对于Android 4.3及更早版本,我使用这个方法:

Uri myUri = data.getData();
Cursor cursor = getContentResolver().query(myUri,new String []{"_data"}, null, null, null);
cursor.moveToFirst();
String filePath = cursor.getString(cursor.getColumnIndex("_data"));
cursor.close();
Run Code Online (Sandbox Code Playgroud)

但对于Android kitKat,它返回null

android

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

如何在swift中的UITableView中滚动UITextView上面的键盘

我找到了针对objective-c的解决方案:在常规UIViewController上的UITableViewCell中将键盘上方的UITextField滚动,但我无法将其改编为swift.

func textViewShouldBeginEditing(textView: UITextView) -> Bool {
    var pointInTable:CGPoint? =  textView.superview?.convertPoint(textView.frame.origin, toView: tableView)
    var contentOffset:CGPoint = tableView.contentOffset
    contentOffset.y  = pointInTable?.y - textView.inputAccessoryView?.frame.size.height
}
Run Code Online (Sandbox Code Playgroud)

我收到错误:

Value of optional type 'CGFloat?' not unwrapped; did you mean to use '!' or '?'?  
Run Code Online (Sandbox Code Playgroud)

我用的时候!要么 ?我收到错误:postfix的操作数'?' 应该有可选的类型; 类型是'CGFloat'

ios swift

0
推荐指数
1
解决办法
7319
查看次数

如何通过NSXMLParser加载xml文件

我找到了NSXMLParser构造函数使用URL的示例,例如:

NSXMLParser(contentsOfURL: (NSURL(string:"http://images.apple.com/main/rss/hotnews/hotnews.rss")))!
Run Code Online (Sandbox Code Playgroud)

但是我找不到如何将它与项目中的xml文件一起使用.

nsxmlparser ios swift

0
推荐指数
1
解决办法
4442
查看次数