我正在制作一个让用户拍照并在缩略图和照片查看器中显示它们的应用程序。 我有NSManagedObject类称为照片和照片有一个方法,需要UIImage并使用UIImagePNGRepresentation()将其转换为PNG,并将其保存到文件系统。 在此操作之后,将图像调整为缩略图大小并保存。 这里的问题是UIImagePNGRepresentation()和图像大小的转换似乎是非常慢,我不知道这是否是一个正确的方法来做到这一点。 告诉我,如果有人知道完成我想要做的最好的方法。 先谢谢你。
我想要做的是在UITextField的开头添加一些无法删除的文本。 当用户像这样在UITextField点击时,我添加这个文本: – (BOOL)textFieldShouldBeginEditing:(UITextField *)textField{ if (textField.text.length == 0) { textField.text = @"myText"; } return YES; } 如何防止用户以正常方式删除此文本? (例如,在TextField的顶部不添加单独的UILabel )。 提前致谢!
我们正在创build一个iOS照片应用程序。 在这样做的时候,我们必须创build大小约2500x1600px的dynamic大小的图片。 一旦这个图像被创build,我们想要在较大的图像上合理快速地绘制较小的图像。 我们可以看到的问题是,获取大于屏幕分辨率的上下文是不可能的。 调用不会崩溃,但会返回一个无上下文。 怎么能这样一个看似简单的任务呢? 其次,一旦创build了这个环境,在大环境中的某个特定位置上画一个小图像的最快方法是什么? 编辑: 我们find了解决scheme。 CGBitmapContextCreate返回nil,因为宽度和高度参数被设置为浮点数,而不是int。 有时候解决scheme就在你的面前,而你却盲目地看不到它。 希望这个答案可以帮助其他人以某种方式有相同的问题。
调用第二个animation之后,如何让一个animation永远持续下去? 例如: 1)启动一个物体脉动2)移动它的脉动3)它继续脉动 除了第二个animation之外,所有的东西都是无止境的停止第一个animation。 以下是一些示例代码: //Pulsate ** [UIView animateWithDuration:0.25 delay:0 options: (UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionRepeat) animations:^{ CGAffineTransform currentTransform = self.transform; CGAffineTransform newTransform1 = CGAffineTransformScale(currentTransform, .95, .95); [self setTransform:newTransform1]; CGAffineTransform newTransform2 = CGAffineTransformScale(currentTransform, 1, 1); [self setTransform:newTransform2]; } completion:nil]; //Move ** [UIView animateWithDuration:0.30 delay:0 options: (UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState ) animations:^{ [[(UIPinchGestureRecognizer*)sender view] setCenter:CGPointMake(myAppDelegate.MCViewReference.center.x-300, […]
我有一个UITableView ,我想对其应用一些转换,所以它将支持从左到右的语言,我做的是以下几点: for(UITableViewCell *cell in self.RSSNewsTableView.visibleCells) { cell.transform = CGAffineTransformMakeRotation(180*0.0174532925); cell.textLabel.transform = CGAffineTransformMakeRotation(180*0.0174532925); cell.detailTextLabel.transform = CGAffineTransformMakeRotation(-M_PI); cell.textLabel.textAlignment = UITextAlignmentRight; // cell.transform = CGAffineTransformMakeRotation(2*M_PI); } 我得到的是以下内容: detailTextLabel的正确转换是detailTextLabel所以它将被正确放置在单元格的textLabel ?
我有下面的代码,将用户的草图数据保存到一个文件… //Auto Save the sketch NSString *filename = [NSString stringWithFormat:@"%@.png", sketchID]; CGImageRef imageRef = CGBitmapContextCreateImage(paintView.canvas.mBitmapContext); UIImage* image = [[UIImage alloc] initWithCGImage:imageRef]; NSData* imageData = UIImagePNGRepresentation(image); [imageData writeToFile:filename atomically:YES]; CGImageRelease(imageRef); [image release]; SketchID是唯一的字母数字值,所以我保存的文件名的一个例子是“p1.png”。 我用来读取文件的代码是… //Load the sketch where the user left off, if there is one if(fileName != nil) { UIImage* image = [UIImage imageWithContentsOfFile:fileName]; if(image […]
我想利用自动布局在iOS 8中自动照顾我的细胞高度,但我讨厌估计行高度滚动(跳动,滚动位置不可预知,等等)如何挑剔。 有没有办法不使用估计,以便表视图预先计算所有的行高,就像它在iOS 7之前(不是太多的单元格,所以不是一个性能问题),但使用iOS 8的高度自动计算?
我已经searchXcode控件,但没有发现任何使GridView像在下面的讲座那样的东西,那么如何做出这样一个? 谢谢
我已经创build了我的向下钻取表的Xcode storyboard来分支到两个细节视图。 我希望它根据我在表格视图中点击的预算对象的状态继续执行。 如果预算对象没有被初始化,我想继续到初始化视图。 如果它已被初始化,我希望它继续到详细视图。 到目前为止,这是我有… – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { /* When a row is selected, the segue creates the detail view controller as the destination. Set the detail view controller's detail item to the item associated with the selected row. */ if ([[segue identifier] isEqualToString:@"showDetailsOfBudget"]) { NSIndexPath *indexPath = [self.budgetsTable indexPathForSelectedRow]; BudgetDetailsViewController *detailsViewController […]
我的属性是在我的NSManagedObject类中声明的,名字为“newPrice”,这导致了“僵尸对象”。 经过几个小时的debugging,我发现有一个方法是释放这个对象,但没有保留它的问题。 把这个属性重命名为“priceNew”后,一切顺利。 我不明白为什么这会造成问题。 财产声明: @property (nonatomic, retain) NSNumber * newPrice; 这个调用导致问题: [self setPieceStateWithPrice:self.action.newPrice]; 经过像self.action.price通过重命名的参数新的一切顺利…