草庐IT

np_image_data

全部标签

core-data - insertNewObjectForEntityForName 导致 NSInternalInconsistencyException 的奇怪行为

我有一个相当奇怪的案例,在尝试使用Swift时出现核心数据错误。我不确定它是来自Swift(测试版错误?)还是我。但是,这是我的测试用例的设置(在VTModelTests.swift中)。varbundle=NSBundle(forClass:VTModelTests.self)varurl=bundle.URLForResource("VTDocument",withExtension:"momd")appleModel=NSManagedObjectModel(contentsOfURL:url)assert(appleModel!=nil)varcoord=NSPersisten

ios - Core Data + Swift + 加载模型不起作用

我用Swift语言生成托管对象,不再用Objective-C。你知道Swift生成是否还不能正常工作吗?我在这一行遇到一个错误:letmodelURL=NSBundle.mainBundle().URLForResource("TA",withExtension:"mom")2014-10-1218:17:13.940TA[1767:555144]CoreData:warning:Unabletoloadclassnamed'Trip'forentity'Trip'.Classnotfound,usingdefaultNSManagedObjectinstead.fatalerror:

ios - 使用 Alamofire 和 multipart/form-data

我无法以正确的方式使用提供给我的API来获得我正在寻找的响应。我已经使用Swift和Alamofire一段时间了,但这是我第一次使用multipart/form-data上传图像。我可以使用Postman上传图像,但无法使用Alamofire框架让我的应用程序发送相同的消息。我的Swift代码:funcpostFulfilWish(wish_id:Int,picture:UIImage,completionHandler:((AnyObject?,ErrorType?)->Void)){varurlPostFulfilWish=Constant.apiUrl;urlPostFulfil

css使用border-image和flex布局设计一个随着文字多少自适应的标题

需求:设计一个标题,让中间部分随着文字而撑大,同时文字渐变,两边自适应,这种情况就不能用传统的背景图片了,想到可以使用图片边框来做解决思路: 1.需要一个大盒子和三个小盒子2.大盒子设置display:flex;左右两个小盒子分别设置flex-grow;并设置背景图片3.给中间盒子设置边框图片(重点)关于边框图片可参考:CSS边框图像(w3school.com.cn)上代码: demo body{ background-image:url('background_main.png'); background-position:centercenter; background

Java发送form-data请求

在Java中发送form-data请求,可以使用ApacheHttpClient或OkHttp这样的HTTP客户端库来发送请求。一、HttpClient1.添加依赖org.apache.httpcomponentshttpclient4.5.132.代码packagerequest;importorg.apache.http.HttpEntity;importorg.apache.http.HttpResponse;importorg.apache.http.client.HttpClient;importorg.apache.http.client.methods.HttpPost;impo

ios - 使用 Star Image 为 UIButton 设置边框

我需要为UIButton图像设置边框。我的按钮图片看起来像这样。我不能为此使用多个图标,因为图像边框的颜色是服务器驱动的,并且来自网络服务响应。所以我不想在我的代码库中硬编码40-50个图标。我只有一个白色背景的星形图标。请告诉我如何实现。我已经尝试使用Button.layer.borderWidth和Button.layer.borderColor,但它给了我一个矩形边框。我想要一个星形边框。 最佳答案 您可以尝试创建一个系统按钮,并根据您的需要更改按钮的色调确保星图仅由星组成,其余部分是透明的。然后尝试更改按钮的tintColo

swift - 使用 cell.imageView.image 的不同大小的图像。 swift

是否可以将所有图像设置为相同大小?我尝试使用cell.imageView?.frame.size.width=something。但是,它不起作用。有什么建议么?谢谢。functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{letcell:UITableViewCell=UITableViewCell(style:UITableViewCellStyle.Subtitle,reuseIdentifier:"Cell")cell.imageView!.

image - 快速将图像添加到 UIAlertController

我想要一个带有图像的简单UIAlertController。我该怎么办?letalertMessage=UIAlertController(title:"ServiceUnavailable",message:"Pleaseretrylater",preferredStyle:.Alert)alertMessage.addAction(UIAlertAction(title:"OK",style:.Default,handler:nil))self.presentViewController(alertMessage,animated:true,completion:nil)

ios - 在 Storyboard 中选择图像时,Image-Set 中的语言方向不生效

我有一个图像集,其方向(languagedirection)属性设置为从左到右。这意味着对于从右到左的语言(即阿拉伯语、希伯来语),图像应该水平镜像。现在,如果我在Storyboard的UIImageView上设置此图像,图像不会镜像RTL语。见下图:WhenIdon'tsettheimageinimageViewfromstoryboardbutloadtheimageincode&setitastheimageView'simagepropertytheimageismirroredforRTLlanguage.Seeimagebelow:ButagainifIsettheimag

ios - AF网络 : Send image from file

我正在尝试发送包含图像的多部分发布请求。以下代码工作正常:manager.POST(apiUrl+"/location/add",parameters:parameters,constructingBodyWithBlock:{(formData:AFMultipartFormData!)->Voidin//formData.appendPartWithFileURL(NSURL(string:location.imagePath!),name:"image",error:nil)},formData.appendPartWithFileData(img,name:imgParam,f