Tag: 客观

调用reloadData时,UICollectionView不会立即更新,而是在30-60秒后随机更新

正如标题所暗示的,我的UICollectionView不会在调用reloadData之后立即更新和显示单元格。 相反,它似乎最终在30-60秒后更新我的collections视图。 我的设置如下: UICollectionView添加到视图控制器在故事板与delegate和dataSource设置为视图控制器和标准sockets设置numberOfSectionsInRow & cellForItemAtIndexPath都实现了并引用原型单元格和cellForItemAtIndexPath里面 这里是转到Twitter的代码,得到一个时间表,把它分配给一个variables,重新加载一个表视图与推文,然后通过推文find照片,并重新加载收集视图与这些项目。 即使我注释掉代码来显示图像,它仍然不会改变任何东西。 SLRequest *timelineRequest = [SLRequest requestForServiceType:SLServiceTypeTwitter requestMethod:SLRequestMethodGET URL:timelineURL parameters:timelineParams]; [timelineRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) { if(responseData) { JSONDecoder *decoder = [[JSONDecoder alloc] init]; NSArray *timeline = [decoder objectWithData:responseData]; [self setTwitterTableData:timeline]; for(NSDictionary *tweet in [self twitterTableData]) { if(![tweet valueForKeyPath:@"entities.media"]) { continue; } for(NSDictionary *photo in [[tweet objectForKey:@"entities"] […]

获取videoIOS 6的所有帧

我想要在iOS6中的video的所有帧到NSArray 。 我使用这个代码: -(void) getAllImagesFromVideo { imagesArray = [[NSMutableArray alloc] init]; times = [[NSMutableArray alloc] init]; for (Float64 i = 0; i < 15; i += 0.033) // For 25 fps in 15 sec of Video { CMTime time = CMTimeMakeWithSeconds(i, 60); [times addObject:[NSValue valueWithCMTime:time]]; } [imageGenerator generateCGImagesAsynchronouslyForTimes:times completionHandler:^(CMTime requestedTime, CGImageRef image, CMTime actualTime, AVAssetImageGeneratorResult […]

围绕其中心旋转UIView保持其大小

我试图旋转一个UIView几个弧度,但应用转换后,它不看它保持其大小。 什么是实现这一目标的正确方法? 这是我正在做什么,我得到了什么(带有箭头的蓝色框是我试图旋转的视图 – 它应该保持与红色框相同的方面): #define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI) double rads = DEGREES_TO_RADIANS(240); CGAffineTransform transform = CGAffineTransformRotate(CGAffineTransformIdentity, rads); self.arrowView.transform = transform; 谢谢!

UITableView部分周围的边框

我们如何可以在tableview的每个部分都有边框? 附上图片来显示我在找什么。 如果您查看图像,则每个tableview部分都有一个边框。

AFNetworking 3.0 AFHTTPSessionManager使用NSOperation

我有一段时间卡住了,我需要帮助。 所以在AFNetworking 2.0我们有AFHTTPRequestOperation所以我可以很容易地使用NSOperationQueue并有一些依赖。 所以现在我们只有AFHTTPSessionManager和NSURLSession没有NSOperation子类。 我有类APIClient子类。 我正在使用该类作为sharedClient单例。 我已经覆盖GET和POST,所以例如GET看起来这样: – (NSURLSessionDataTask *)GET:(NSString *)URLString parameters:(NSDictionary *)parameters success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure { NSURLSessionDataTask *task = [super GET:URLString parameters:parameters success:^(NSURLSessionDataTask *task, id responseObject) { success(task, responseObject); } failure:^(NSURLSessionDataTask *task, NSError *error) { failure(task, [Response createErrorWithAFNetworkingError:error]); }]; return task; } 你有任何想法如何实现这种方式(如果可能的话)包装为NSOperation ? 所以我想要做的 – 我想能够并行运行两个networking调用,然后有另一个方法调用,这依赖于前两个调用的第二个networking调用。 […]

dynamic调整UITableViewCell到UILabel的高度

我想根据标签的高度和标签的高度来调整单元格的高度。 或者有什么办法可以根据在UITextViewinput的文本来调整单元格的高度?

我可以使用AVFoundation将下载的video帧传输到OpenGL ES纹理中吗?

我已经能够使用AVFoundation的AVAssetReader类将video帧上传到OpenGL ES纹理。 但是,它有一个警告 ,因为在与指向远程媒体的AVURLAsset一起使用时会失败。 这个故障没有很好的logging,我想知道是否有任何解决方法的缺点。

如何在iPhone上闪烁(或闪烁)光标?

我试图在UIKit中创build一个自定义的“闪烁的光标”,我已经尝试了如下所示,有2个函数,基本上保持相互调用,直到光标被隐藏。 但是,这导致了一个很好的无限recursion…出于某种原因,函数立即调用对方,而不是每半秒如预期。 如果“finished”参数不是YES(通过取消注释“if(!ok)”行),但是这导致根本没有animation… 更好的主意? 我错过了什么,有没有一个更简单的方法来做一个“闪烁的光标”? – (void)onBlinkIn:(NSString *)animationID finished:(BOOL)ok context:(void *)ctx { if (cursorView.hidden) return; //if (!ok) return; [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; [UIView setAnimationDelegate:self]; [UIView setAnimationDidStopSelector:@selector(onBlinkOut:finished:context:)]; cursorView.textColor = [UIColor grayColor]; [UIView commitAnimations]; } – (void)onBlinkOut:(NSString *)animationID finished:(BOOL)ok context:(void *)ctx { if (cursorView.hidden) return; [UIView beginAnimations:nil context:UIGraphicsGetCurrentContext()]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView setAnimationDuration:0.5f]; [UIView setAnimationDelegate:self]; […]

UICollectionView的cellForItemAtIndexPath没有被调用

只有我第二次使用UICollectionView的,也许我咬了更多比我可以咀嚼,但不过: 我正在实现一个UICollectionView(myCollectionView),它使用自定义UICollectionViewCell我已经subclassed。 子类(FullReceiptCell)包含UITableView的和是视图控制器的大小。 我试图让FullReceiptCells之间的水平滚动。 包含myCollectionView的子类UICollectionViewController被推送到导航控制器堆栈。 目前,启用myCollectionView和水平滚动。 但是,没有可见的单元格。 我已经证实了 – (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section 已经运行并返回一个大于0的整数。我也确认myCollectionView的委托和数据源在IB中正确设置为子类UICollectionViewController。 要加载单元格的方法: – (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath 没有被调用。 这里是我在该控制器中推送UICollectionViewController和我的viewDidLoad方法的地方(注意:initWithBill是正常初始化程序的覆盖): 在以前的ViewControllers .m文件中: FullReceiptViewController *test = [[FullReceiptViewController alloc] initWithBill:currentBill]; test.title = @"Review"; [self.navigationController pushViewController:test animated:YES]; 在FullReceiptViewController.m中: – (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. [self.myCollectionView […]

为TableView中的所有单元格设置标签的正确方法

我正在使用一个tableView中的button,当我按下时,我得到的indexPath.row 。 但是,当单元格可以在屏幕上显示而不scroll时,它才能正常工作。 一旦tableView可以滚动,我滚动tableview, indexPath.row返回是一个错误的值,我注意到,最初设置20个对象,例如Check只是打印9次没有20。 – (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; lBtnWithAction = [[UIButton alloc] initWithFrame:CGRectMake(liLight1Xcord + 23, 10, liLight1Width + 5, liLight1Height + 25)]; lBtnWithAction.tag = ROW_BUTTON_ACTION; lBtnWithAction.titleLabel.font = luiFontCheckmark; lBtnWithAction.tintColor = [UIColor blackColor]; lBtnWithAction.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin; […]