小编Shi*_*rma的帖子

iOS NSAttributedString表情符号透明度/ alpha

我正在使用UITextView,并希望文本的某些部分是透明的.

我目前正在使用NSAttributedString和NSForegroundColorAttribute,其颜色具有所需的透明度.

它适用于常规字符,但不适用于表情符号.是否可以在UITextView中将表情符号设置为透明?如果是这样,怎么样?

注意:我希望支持iOS6或更高版本.

transparency alpha nsattributedstring ios emoji

10
推荐指数
0
解决办法
996
查看次数

企业应用程序开始需要更长时间

我目前正在经历一些奇怪的行为,使用相同的代码库只是使用不同的证书签名:

1) Bundle identifier: com.mycompany.A, Normal App-Store Distribution certificate 

2) Bundle identifier: com.mycompany.B, Enterprise Distribution certificate
Run Code Online (Sandbox Code Playgroud)

如上所述,两个应用程序都具有完全相同的代码和资产,但唯一不同的是捆绑标识符和用于归档它们的签名凭据.

奇怪的是,与app B(2)相比,app A(1)需要大约40%的时间才能启动.这可能与Apple更密切地检查企业证书有什么关系吗?或者我只是以错误的方式编译它?关于如何缓解这个问题的任何想法?

我已经检查过我在applicationDidFinishLaunching中没有任何长时间运行的代码:这会阻止启动,它看起来确实是iOS,需要很长时间才能启动应用程序并将其移交给我的控件.

performance xcode enterprise ios

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

iOS快速从服务器加载数据

我正在开发一个购物应用程序,我使用网络服务来获取数据,即产品列表等。但是加载需要太多时间,因此使我的应用程序非常慢。

这个问题有什么解决办法吗?

下面是我尝试获取产品列表的代码。

NSURL * Url=[NSURL URLWithString:@"URL/api/product"]; 
NSData * Data=[NSData dataWithContentsOfURL:Url];
NSString *str=[[NSString alloc]initWithData:Data encoding:NSUTF8StringEncoding];
NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:[strinng dataUsingEncoding:NSUTF8StringEncoding] options:NSJSONReadingMutableContainers error:nil]; 
Run Code Online (Sandbox Code Playgroud)

无法放入 JSON 响应,因为它太多了。

json objective-c ios

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

错误 : An -observeValueForKeyPath:ofObject:change:context: 消息已收到但未处理

我想根据内容动态设置集合视图的高度,我尝试了以下代码:

    override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(true)

    self.ItemCollection.addObserver(self , forKeyPath: "contentSize", options: NSKeyValueObservingOptions.old, context: nil)


}


func observeValueForKeyPath(keyPath: String?, ofObject object: AnyObject?, change: [String : AnyObject]?, context: UnsafeMutableRawPointer) {

    let newHeight : CGFloat = self.ItemCollection.collectionViewLayout.collectionViewContentSize.height

    var frame : CGRect! = self.ItemCollection.frame
    frame.size.height = newHeight

    self.ItemCollection.frame = frame


}    

override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(true)

            self.ItemCollection.removeObserver(self, forKeyPath: "contentSize")
}
Run Code Online (Sandbox Code Playgroud)

我在这条线上收到错误:

 self.ItemCollection.addObserver(self , forKeyPath: "contentSize", options: NSKeyValueObservingOptions.old, context: nil)
Run Code Online (Sandbox Code Playgroud)

以下是错误:

An -observeValueForKeyPath:ofObject:change:context: message was received but not handled.
Key path: …
Run Code Online (Sandbox Code Playgroud)

xcode ios swift

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

创建字典数组 iOS Swift

我正在尝试实现一系列字典,但得到的输出与我的预期不同。

在下面的代码片段中,我创建了一个数组、一个字典并执行追加操作:

var MemberArray = [[String: Any]]()

let dict = ["member_status":"1", 
            "member_id": memid ,
            "membership_number": memshpid, 
            "name": memname, 
            "mobile":memno ,
            "billing":"1"] as NSDictionary

MemberArray.append(dict as! [String : Any])
Run Code Online (Sandbox Code Playgroud)

我需要它是这样的:

[
  {
"member_status": 1,
"member_id": 3,
"membership_number": "GI99010286",
"name": "Thomas",
"mobile": "9873684678",
"billing": 0
  },
  {
"member_status": 1,
"member_id": 5,
"membership_number": "GI99010144",
"name": "Raj",
"mobile": "9873684678",
"billing": 1
  }
]
Run Code Online (Sandbox Code Playgroud)

但我得到以下信息:

[
  [
"member_status": 1,
"member_id": 3,
"membership_number": "GI99010286",
"name": "Thomas",
"mobile": "9873684678",
"billing": 0
 ],
 [
"member_status": 1,
"member_id": 5, …
Run Code Online (Sandbox Code Playgroud)

arrays dictionary swift

-2
推荐指数
1
解决办法
2539
查看次数