自定义AlertView与背景

每个人,我需要在UIAlertView上设置一个图像。 我已经附上了我的UIAlertview图像prob .. 我已经使用这个代码行 UIAlertView *theAlert = [[[UIAlertView alloc] initWithTitle:@"Atention" message: @"YOUR MESSAGE HERE", nil) delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil] autorelease]; [theAlert show]; UILabel *theTitle = [theAlert valueForKey:@"_titleLabel"]; [theTitle setTextColor:[UIColor redColor]]; UILabel *theBody = [theAlert valueForKey:@"_bodyTextLabel"]; [theBody setTextColor:[UIColor blueColor]]; UIImage *theImage = [UIImage imageNamed:@"Background.png"]; theImage = [theImage stretchableImageWithLeftCapWidth:16 topCapHeight:16]; CGSize theSize = [theAlert frame].size; UIGraphicsBeginImageContext(theSize); [theImage drawInRect:CGRectMake(0, […]

我的自定义button没有得到点击iCarousel iOS?

在我的例子中,我正在使用iCarousel在其中我试图扩大图像点击它? 我做了什么,图像展开后,我在view右下angular添加backButton ,以便我可以返回到原始视图。 但是那个button没有得到点击事件。 我哪里错了? 这是我的代码。 – (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view{ UIButton *button = (UIButton *)view; UIView *buttonBackView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, 475, 300)]; [buttonBackView setBackgroundColor:[UIColor blackColor]]; button = [UIButton buttonWithType:UIButtonTypeCustom]; button.frame = CGRectMake(0.0f, 0.0f, 475,300); UIImage *image=[_rareCSNYArrayImageItems objectAtIndex:index]; [button setBackgroundImage:image forState:UIControlStateNormal]; [button addTarget:self action:@selector(buttonTapped:) forControlEvents:UIControlEventTouchUpInside]; [buttonBackView addSubview:button]; return buttonBackView; } – (void)buttonTapped:(UIButton *)sender { […]

iOS背景获取

我有点困惑与背景获取。 我在苹果开发者文档中看到,当操作系统决定应该这样做时,用户无法控制后台获取,而在苹果开发者论坛上,苹果员工表示,如果用户杀死应用程序(在家中双击并button向上滑动)获取不会发生,在这种情况下,用户可以控制后台获取。 那么有人请向我澄清,如果用户使用任务pipe理器杀死应用程序将背景获取仍然继续在后台或它与应用程序同时被杀死。 苹果文档: https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH4-SW1

CAGradientLayer对angular线渐变

我使用以下CAGradientLayer: let layer = CAGradientLayer() layer.colors = [ UIColor.redColor().CGColor, UIColor.greenColor().CGColor, UIColor.blueColor().CGColor ] layer.startPoint = CGPointMake(0, 1) layer.endPoint = CGPointMake(1, 0) layer.locations = [0.0, 0.6, 1.0] 但是当我为图层设置边界属性时,它只是拉伸一个方形渐变。 我需要一个类似于Sketch 3应用程序图像的结果(请参阅上文)。 我怎样才能做到这一点?

使用SOAP将使用WCF服务的图像从iPhone上传到服务器

hiii,我使用wcf SOAP服务为我的应用程序,我发送下面的请求。 postStr = [NSString stringWithFormat:@"<?xml version=\"1.0\"?>\n" "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">\n" "<s:Body>\n" "<InsUpdDelActivityInfo xmlns=\"http://tempuri.org/\">\n" "<objEventsContent xmlns:d4p1=\"http://schemas.datacontract.org/2004/07/iCampuslite.Model.ActivityStream\" xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n" "<d4p1:ActCommentId i:nil=\"true\" />\n" "<d4p1:ActSubTypeCd i:nil=\"true\" />\n" "<d4p1:ActType>Status</d4p1:ActType>\n" "<d4p1:ActTypeCd>1</d4p1:ActTypeCd>\n" "<d4p1:ActivityAnswersList />\n" "<d4p1:ActivityComments />\n" "<d4p1:ActivityId i:nil=\"true\" />\n" "<d4p1:ActivityLike />\n" "<d4p1:ActivityName>%@</d4p1:ActivityName>\n" "<d4p1:ActivityStreamImagesBytes>%@</d4p1:ActivityStreamImagesBytes>\n" "<d4p1:AnswerDesc i:nil=\"true\" />\n" "<d4p1:AnswerId>0</d4p1:AnswerId>\n" "<d4p1:CommentDesc i:nil=\"true\" />\n" "<d4p1:CommentId i:nil=\"true\" />\n" "<d4p1:CreatedUserId>%@</d4p1:CreatedUserId>\n" "<d4p1:CreatedUserName i:nil=\"true\" />\n" "<d4p1:FileOrLinkName i:nil=\"true\" />\n" "<d4p1:IsLiked>0</d4p1:IsLiked>\n" "<d4p1:IsTotalSchool i:nil=\"true\" />\n" […]

UICollectionView删除部分与UICollectionViewFlowLayout中断

我有一个数据集被分为多个部分,但是,我想显示在一个集合查看没有中断部分。 这里是我想要实现的一个例子: Instead of: 0-0 0-1 0-2 0-3 1-0 1-1 2-0 3-0 I want: 0-0 0-1 0-2 0-3 1-0 1-1 2-0 3-0 我意识到解决scheme可能在于一个自定义的UICollectionViewLayout子类,但我不知道如何实现这样的东西。 谢谢

iOS UIImagePickerController,设置框架

我试图完成以下结果: 设置我的UIImagePickerController框架,可以说200 x 200, 设置我的框架在右下angular(就像Facetime / Skype一样) 并显示前/后(无所谓)相机stream。 这是我的代码,出于某种原因,setFrame不工作! self.picker = [[UIImagePickerController alloc] init]; self.picker.sourceType = UIImagePickerControllerSourceTypeCamera; self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto; self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear; self.picker.showsCameraControls = NO; self.picker.navigationBarHidden = YES; self.picker.view.frame = CGRectMake(600, 400, 200, 200); // NOT WORKING !!! self.picker.toolbarHidden = YES; self.picker.wantsFullScreenLayout = NO; self.picker.delegate = delegate; [self presentViewController:self.picker animated:YES completion:nil]; 我看过类似的SO主题,但他们都谈论如何 在UIImagePickerController之上设置视图,而不是我的问题。 我已经尝试添加self.picker到一个自定义UIView大小200×200但仍然 […]

UITableViewRowAnimation被忽略

我正在使用NSFetchedResultsController来填充我的表。 我的表中的数据按升序排列(最新的消息在底部)。 更多的数据通过“无限滚动”加载到顶部:例如当用户滚动到顶部时,更多的消息被加载。 我的NSFetchedResultsControllerDelegate像往常一样定义,正如苹果文档中推荐的那样:通过插入新行 – (void)controller:(NSFetchedResultsController*)controller didChangeObject:(id)anObject atIndexPath:(NSIndexPath*)indexPath forChangeType:(NSFetchedResultsChangeType)type newIndexPath:(NSIndexPath*)newIndexPath { switch(type) { case NSFetchedResultsChangeInsert: NSLog(@"insertion at row %d", newIndexPath.row); [self.table insertRowsAtIndexPaths:@[newIndexPath] withRowAnimation:UITableViewRowAnimationNone]; break; 现在,这是我的问题:插入新行时,它们总是以滑动“向下”的方式animation。 在无限滚动向上看起来不好。 无论我传递UITableViewRowAnimationNone , UITableViewRowAnimationTop还是UITableViewRowAnimationBottom作为参数,都会发生这种情况 – 该选项似乎完全被忽略。 任何想法如何正确animation表?

UILabel的backgroundColor是不是animation?

我有一个gridView,我用来显示几个GridViewCell : UIView 。 GidViewCell将UILabel添加到自身,并将UITapGestureRecognizer到自身。 UITapGestureRecognizer *gestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapped:)]; [self addGestureRecognizer:gestureRecognizer]; [gestureRecognizer release]; 在tapped:我想玩一些animation,包括改变标签的背景颜色 – (void) tapped:(id)sender { [UIView animateWithDuration:1.0 delay:0 options:(UIViewAnimationOptionAllowUserInteraction) animations:^{ [(UILabel *)[[self subviews] objectAtIndex:0] setBackgroundColor:[UIColor blueColor]]; } completion:^(BOOL finished){ [(UILabel *)[[self subviews] objectAtIndex:0] setBackgroundColor:[UIColor whiteColor]]; } ]; [self.delegate didSelectGridViewCell:self]; } 但是,标签只是一眨眼的蓝色 – 如果有的话。 如果我使用相同的代码,但调整标签的alpha而不是背景颜色,一切都按预期工作。 苹果的文档列出backgroundColor作为animation。 是吗? 难道我做错了什么?

Swift – 打开内置的iOS字典来查找单词的含义

在我的项目中,我想打开iOS内置的字典来查找单词的含义,甚至更好,直接在我的应用程序中获取单词的含义。 目前我发现如何检查一个string拼写正确使用UITextChecker func wordIsReal(word: String) -> Bool { let checker = UITextChecker() let range = NSMakeRange(0, count(word)) let misspelledRange = checker.rangeOfMisspelledWordInString(word, range: range, startingAt: 0, wrap: false, language: "en") return misspelledRange.location == NSNotFound }