将UIView原点转换为其Window坐标系

我想在窗口坐标系中获取scrollView的原点。 例如,目前,scollView的来源是(0,51)。 但在窗口坐标系中,它应该是51 + 44(导航栏高度)+20(状态栏高度)= 115。在窗口坐标系中,scrollView.frame.origin应该是(0,115)。 我尝试使用convertPoint:方法,但有时得到(0,51)或(0,0)。 请为此提供解决scheme。 谢谢

错误与cocoapods link_with更新到1.0.0后

我今天更新了cocoapods到1.0.0版本。 当我更新豆荚时,我得到了这个string: [!] Invalid Podfile file: [!] The specification of link_with in the Podfile is now unsupported, please use target blocks instead.. 我已经删除了我的podFile中的link_with,但我无法构build项目,因为我有许多Match-O-Linkers。 任何人都知道我应该如何解决这个问题? 这是我的Podfile现在: source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' inhibit_all_warnings! pod 'pop', '~> 1.0' pod 'AFNetworking', '~> 1.3' pod 'SDWebImage', '~> 3.7' pod 'GoogleAnalytics', '~> 3' pod 'ARAnalytics' , :subspecs => ["Crashlytics", "Amplitude", "DSL"] […]

从代码中调用IBAction的最佳方式是什么?

说例如我有一个IBAction是连接到一个UIButton在界面生成器。 – (IBAction)functionToBeCalled:(id)sender { // do something here } 在我的代码中,例如用另一种方法说,调用这个IBAction的最好方法是什么? 如果我尝试像这样调用它,我收到一个错误: [self functionToBeCalled:]; 但是,如果我尝试像这样调用它(我认为有一点欺骗),它可以正常工作: [self functionToBeCalled:0]; 什么是适当的方式来正确调用它?

缺less必需的图标文件。 该捆绑包不包含完全为'57×57'像素的iPhone / iPod Touch的应用程序图标

我试图在Appstore中更新我的应用程序,并且我已经开始收到此失败消息。 我检查了互联网的任何解决scheme,但没有一个工作。 我没有改变我的图标,所以这个失败不应该出现。 我已经检查过plist文件,但始终是相同的问题。 理论上这个捆绑包缺less两个图标57×57和72×72的大小。 重命名图标并设置项目中的整个图标包,仍是同样的问题。

如何在ios中为UITextView设置内容embedded

我有一个UITextView和设置内容插入为 [atextView setContentInset:UIEdgeInsetsMake(0, 10, 0, 0)]; 此代码在iOS 6.1及以下版本中工作,但在iOS 7.0中没有任何反应。

在Swift中获取文件大小

我尝试了几种方法来获取文件大小,但总是得到零。 let path = NSBundle.mainBundle().pathForResource("movie", ofType: "mov") let attr = NSFileManager.defaultManager().attributesOfFileSystemForPath(path!, error: nil) if let attr = attr { let size: AnyObject? = attr[NSFileSize] println("File size = \(size)") } 我得到日志: File size = nil

Swift – 如何设置imageView的angular点半径

在objective-c这样的行中 self.mainImageView.layer.cornerRadius = CGRectGetWidth(self.mainImageView.frame)/4.0f; 做它的工作,我使用类比在Swift中尝试了它 self.mainImageView.layer.cornerRadius = CGRectGetWidth(self.mainImageView.frame)/4.0 并没有改变什么,angular落和以前一样。 而且,XCode不显示任何语法错误。 Swift是否支持其他任何方式来实现这个目标? 我在这里检查了一些其他的线程,通常在上面显示的方式在Swift中完成。

如何在运行时更改约束优先级

我有一个dynamic高度的视图,我试图在运行时改变这个视图的高度优先。 这是我的代码的一部分; if (index == 0) { surveyViewHeightConstraint.constant = 0; surveyViewHeightConstraint.priority = 1000; } else if (index == 1) { surveyViewHeightConstraint.constant = 163; surveyViewHeightConstraint.priority = 500; } 我正在改变索引与button的行动。 当我运行这个代码,我得到这个错误: *** Assertion failure in -[NSLayoutConstraint setPriority:], /SourceCache/Foundation/Foundation-1141.1/Layout.subproj/NSLayoutConstraint.m:174 我在这里犯的错误是什么?

在iPad / iPhone应用程序中使用众所周知的免费内存代码是否合法?

内存是一个iphone ipad应用程序的问题,特别是对于ipad,如果你想做一些大事。 那么,这两个代码片段可以获得设备的当前可用内存; 2.强制释放内存。 我们可以在应用程序中使用它吗? Appstore会允许这个吗? #import <mach/mach.h> #import <mach/mach_host.h> static void print_free_memory () { mach_port_t host_port; mach_msg_type_number_t host_size; vm_size_t pagesize; host_port = mach_host_self(); host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); host_page_size(host_port, &pagesize); vm_statistics_data_t vm_stat; if (host_statistics(host_port, HOST_VM_INFO, (host_info_t)&vm_stat, &host_size) != KERN_SUCCESS) NSLog(@"Failed to fetch vm statistics"); /* Stats in bytes */ natural_t mem_used = (vm_stat.active_count + […]

如何将字节数组转换为UIImage

我有一个web服务,发送给我一个像这样的字节数组: <ax23:IMGBLOB>-119,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,100,0,0,0,106,8,3,0,0,0,125,54,4,22,0,0,0,51,80,76,84,69,0,0,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-73,-107,-30,-126,0,0,0,16,116,82,78,83,0,16,32,48,64,80,96,112,-128,-112,-96,-80,-64,-48,-32,-16,84,-32,-88,-56,0,0,2,126,73,68,65,84,120,-38,-19,90,65,-110,-124,32,12,4,68,64,69,-32,-1,-81,-35,-53,-78,-96,40,4,-79,-70,118,-86,-90,-113,51,106,-101,116,-120,33,-127,-3,43,72,101,-84,13,127,-80,-42,40,-7,42,-63,100,108,-72,-124,53,-45,75,38,-84,62,84,-32,-41,97,-125,-72,118,-95,9,-89,-7,0,-123,-56,-115,-88,-101,35,-98,90,-79,-122,14,-84,-113,-84,49,62,116,-63,-101,126,-71,-9,112,-58,-66,25,45,127,-95,-51,118,113,-127,-20,52,-29,124,-1,34,121,-31,78,-71,-100,-119,76,-113,-32,-5,-111,65,-117,-37,43,-11,-23,82,65,118,-107,63,40,42,91,-21,-24,-96,12,-47,101,-22,64,33,8,-122,31,104,20,-123,99,9,9,-106,104,-67,-80,-7,123,-79,38,-78,-73,114,51,35,99,118,29,44,-21,-45,-27,-59,-13,59,-87,-66,-14,-118,117,66,-91,120,89,104,-102,-69,7,57,124,114,20,-11,101,-118,119,-2,40,-37,-91,69,35,111,99,-60,-25,28,99,44,-2,46,46,-9,-100,99,-108,101,-81,-28,-85,-56,49,-50,98,-86,-126,56,-50,6,-64,93,41,75,-23,44,63,13,86,29,-2,-34,97,38,69,-33,32,-44,-83,-61,-72,-89,-26,4,122,102,-14,-68,-8,-93,16,100,80,-106,-14,-123,69,52,113,102,47,96,-114,79,19,-105,-122,88,-10,10,-74,43,83,-72,-49,-87,-57,33,-82,84,-47,45,-43,-71,-115,5,92,-97,-10,-102,37,-72,104,72,-43,126,111,120,-81,41,46,91,-20,-51,-16,-115,-9,-88,94,83,100,-15,-53,116,79,18,97,37,113,-35,23,-17,-19,99,30,-72,5,-79,-24,45,-77,-108,63,-77,-22,54,9,-67,-24,-43,39,-17,-104,40,123,-101,-124,94,-58,-120,83,2,-77,77,111,-79,112,-126,-99,-88,-2,-78,-57,39,24,2,73,-62,-62,-119,53,-5,49,-128,101,23,73,-16,21,9,-53,-57,-86,72,73,35,73,112,-110,17,-18,81,-71,93,59,-103,36,-63,-118,-74,40,38,-41,125,35,-112,-108,48,-68,-107,-118,109,78,98,-70,72,8,-27,-84,73,36,-55,119,68,18,-54,86,-79,-44,-102,16,92,44,84,-79,93,74,35,7,73,74,-97,1,72,66,-104,-21,36,60,102,-78,33,18,-53,10,8,8,9,-64,93,31,41,-4,90,13,97,-56,98,-124,-92,21,72,-126,28,77,-11,27,37,-43,67,62,90,-112,-49,47,-94,-112,24,40,-119,4,-71,36,-126,20,119,-112,50,21,89,112,-89,-51,68,-101,-60,78,-99,91,7,-56,38,8,-79,-99,-125,108,76,-79,91,-20,-9,-101,5,54,122,6,-46,-10,64,52,112,32,-83,40,68,83,13,-47,30,-124,52,58,17,45,91,68,-13,25,-46,70,71,12,4,16,-93,13,-64,-112,102,37,-113,-101,-74,-66,113,-45,22,18,7,98,112,6,29,1,-30,-121,-103,-8,-79,108,57,96,118,-75,1,-77,43,6,-52,-128,81,57,116,-24,-113,63,-66,-128,63,-120,-127,63,82,66,63,28,99,56,-2,-104,15,-2,-64,-46,-8,-47,-85,47,-66,-8,-30,-77,-16,3,-74,-58,-81,-89,-116,-22,56,-74,0,0,0,0,73,69,78,68,-82,66,96,-126,@@@@</ax23:IMGBLOB> 这个字节数组在Java中用于获取图像,我一直在尝试几种方法,但没有成功,我将在下面发布其中的一个: -(UIImageView *)convierteImagen: (NSMutableString *)cadenaImagen{ //NSString to NSData (temporary) NSData *tempData = [cadenaImagen dataUsingEncoding:NSUTF8StringEncoding]; //NSLog(@"datos crudos: %@", tempData); //2.NSData to Bytes const void *bytes2 = [tempData bytes]; int8_t *bytes = (int8_t*)bytes2; int len = tempData.length; cadenaImagen = [[NSMutableString alloc]init]; [cadenaImagen appendString:@"["]; for (int i = 0; i < len; i++) { if (i) […]