获取所有安装的应用程序列表

我想获得所有安装的应用程序(NSArray)的列表。 我的应用程序是一个越狱应用程序,位于/应用程序,所以沙箱在那里没有问题。 有什么办法可以得到应用程序商店应用程序的列表吗? 我已经看到在其他应用程序(Activator,SBSettings …)。 我不知道如何做到这一点,因为所有的应用程序沙箱有这么大的代码,所以我不知道如何才能访问沙箱内的.app文件夹。

在iOS上写一个文件

我如何在iOS上编写文件? 我试图用下面的代码做,但我做错了什么: char *saves = "abcd"; NSData *data = [[NSData alloc] initWithBytes:saves length:4]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *appFile = [documentsDirectory stringByAppendingPathComponent:@"MyFile"]; [data writeToFile:appFile atomically:YES]; 我在资源上创build了MyFile.txt。

如何dynamic计算UILabel高度?

我想根据给定的文本dynamic地计算UILabel的行数和高度。

在Swift中从nib自定义UITableViewCell

我试图从一个笔尖创build一个自定义表格视图单元格。 我在这里指的是这篇文章。 我面临两个问题。 我创build了一个带有UITableViewCell对象的.xib文件。 我创build了UITableViewCell一个子类,并将其设置为单元的类和Cell作为可重用的标识符。 import UIKit class CustomOneCell: UITableViewCell { @IBOutlet weak var middleLabel: UILabel! @IBOutlet weak var leftLabel: UILabel! @IBOutlet weak var rightLabel: UILabel! required init(coder aDecoder: NSCoder!) { super.init(coder: aDecoder) } override init(style: UITableViewCellStyle, reuseIdentifier: String!) { super.init(style: style, reuseIdentifier: reuseIdentifier) } override func awakeFromNib() { super.awakeFromNib() // Initialization code } override […]

确定iOS设备上可用的RAM数量

你可能已经看到了许多“系统信息”应用程序,其中显示的东西,如电池剩余时间,甚至像内存等系统信息。 以类似的方式,有没有办法从我的应用程序检索当前可用的RAM的数量,以便我可以做出更好的决定,何时最好转储或保留某些视图以避免内存警告?

如何在上传到服务器之前在iPhone OS SDK上压缩/调整图像大小?

我正在使用下面的代码在iOS上使用Imgur将图像上传到服务器: NSData* imageData = UIImagePNGRepresentation(image); NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString* fullPathToFile = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"SBTempImage.png"]; [imageData writeToFile:fullPathToFile atomically:NO]; [uploadRequest setFile:fullPathToFile forKey:@"image"]; 在模拟器中运行时,代码工作正常,并从模拟器的照片库上载文件,因为我在快速以太网连接上。 但是,当select使用iPhone拍摄的图像时,相同的代码会在iPhone上超时。 所以,我试图从networking上保存一个小图片,并尝试上传,这工作。 这导致我相信iPhone所拍摄的大图像会超越3Gnetworking的速度。 发送之前有什么办法来压缩/调整图像的大小? 谢谢!

iOS7 UITextView contentsize.height替代

我正在从iOS 6.1移植到iOS 7的应用程序之一。我正在使用一个布局,其中有一个固定宽度的UITextView ,但它的高度是基于其内容大小。 对于iOS 6.1来说,检查contentize.height并将其设置为textview的框架高度就足够了,但在iOS 7上不起作用。 我怎样才能创build一个固定宽度的UITextView ,但基于它显示的文本的dynamic高度? 注意:我从代码创build这些视图,而不是使用Interface Builder。

如何缩小UIImage,使其变得脆弱/锐利,而不是模糊?

我需要缩小一幅图像,但要锐利。 在Photoshop中,例如,图像尺寸缩小选项“Bicubic Smoother”(模糊)和“Bicubic Sharper”。 这个图像缩小algorithm是开源还是在某个地方logging,或者SDK是否提供了这样的方法?

模态视图控制器 – 如何显示和解除

在最后一个星期,我打破了如何解决显示和解散多个视图控制器的问题。 我已经创build了一个示例项目,并直接从项目中粘贴代码。 我有3个视图控制器与他们相应的.xib文件。 MainViewController,VC1和VC2。 我在主视图控制器上有两个button。 – (IBAction)VC1Pressed:(UIButton *)sender { VC1 *vc1 = [[VC1 alloc] initWithNibName:@"VC1" bundle:nil]; [vc1 setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; [self presentViewController:vc1 animated:YES completion:nil]; } 这将打开VC1没有问题。 在VC1中,我有另一个应该打开VC2的button,同时closuresVC1。 – (IBAction)buttonPressedFromVC1:(UIButton *)sender { VC2 *vc2 = [[VC2 alloc] initWithNibName:@"VC2" bundle:nil]; [vc2 setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal]; [self presentViewController:vc2 animated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil]; } // This shows a warning: Attempt to dismiss from […]

从命令行terminal创build带有位代码启用和位代码禁用的设备和通用configuration的iOS框架

#!/bin/sh UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal # make sure the output directory exists mkdir -p "${UNIVERSAL_OUTPUTFOLDER}" # Step 1. Build Device and Simulator versions xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO \ -configuration ${CONFIGURATION} -sdk iphoneos \ BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} \ -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" \ BUILD_ROOT="${BUILD_ROOT}" clean build # Step 2. Copy the framework structure […]