Tag: 目标

如何根据框架在video中设置CATextLayer?

我已经尝试了许多想法,但没有成功,我的问题是,我有一个video,我提供了一个function,在video上写文本,并拖放到video上的文本现在我魔棒设置CATextlayervideo与propper由用户设置的位置,但不显示在正确的位置,所以请帮助我。 这是我为此使用的代码。 CATextLayer *titleLayer = [CATextLayer layer];//<========code to set the text titleLayer.string = self.strText; titleLayer.font = (__bridge CFTypeRef)(self.fonts);; titleLayer.fontSize = titleLayer.fontSize; titleLayer.position = CGPointMake (titleLayer.fontSize,titleLayer.fontSize); //?? titleLayer.shadowOpacity = 0.5; titleLayer.alignmentMode = kCAAlignmentCenter; titleLayer.bounds = CGRectMake(self.rectText.origin.x,self.rectText.origin.y-52, 480, 480); //You may need to adjust this for proper display [titleLayer setBackgroundColor:[UIColor redColor].CGColor]; [parentLayer addSublayer:titleLayer]; //ONLY IF WE ADDED […]

如何删除已删除的UIImage

嗨,伙计们,我想我的PanGesture我使用下面的代码中的图像擦除代码: UIImage * image = [UIImage imageNamed:@"326d4fb72362a2e44659141cadfc4977.jpg"]; holderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 235)]; imgForeground = [[UIImageView alloc] initWithFrame:[holderView frame]]; [imgForeground setImage:image]; [holderView addSubview:imgForeground]; UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(move:)]; [panRecognizer setMinimumNumberOfTouches:1]; [panRecognizer setMaximumNumberOfTouches:1]; [panRecognizer setDelegate:self]; [holderView addGestureRecognizer:panRecognizer]; [self.view addSubview:holderView]; 然后我在这里处理 -(void)move:(id)sender { CGPoint currentPoint; if([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateBegan){ lastPoint = [sender locationInView:imgForeground]; […]

如何获取NSString中的特定字符的所有NSRange?

我有两个NSString: orgText和searchLetter 。 我想用红色突出显示orgText中orgText每一个出现。 我怎样才能得到所有searchLetter ? 例如: suppose: orgText = "abcahaiapaoiuiapplma" searchLetter = "a". 我想在红色的“abcahaiapaoiuiapplma”中突出所有“a”事件。 谢谢。

获取失败块AFNetworking 3.0上的responseObject

我怎么能从AFNetworking 3.x中的失败块得到响应string, 在2.x版本中,这样做的方法是: [manager GET:path parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { NSDictionary *dictionary_FetchResult = responseObject; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { NSDictionary *dictionary_FetchResult = operation.responseObject; }]; 但在3.x版本中,在返回块的参数中没有任何操作,如下所示: [manager POST:path parameters:parameters progress:^(NSProgress * _Nonnull uploadProgress) { } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { NSDictionary *dictionary_FetchResult = responseObject; } failure:^(NSURLSessionDataTask * _Nullable task, NSError * […]

如何隐藏/显示导航栏中的右键

我需要隐藏导航栏中的右键,然后在用户select一些选项后取消隐藏。 不幸的是,以下不起作用: NO GOOD: self.navigationItem.rightBarButtonItem.hidden = YES; // FOO CODE 有没有办法?

在Objective-C中实现倒数计时器?

我是iOS编程新手。 我正在研究匹配游戏的单词。 在这个游戏中,我需要实现时间计数器,显示分钟和秒。 我希望当我的比赛开始时我的计时器开始3分钟。 现在我想用秒来反向减less这个定时器。 我的代码只是数秒钟..这里是我的代码: secondsLeft–; int seconds = (secondsLeft %3600) % 60; Timerlbl.text = [NSString stringWithFormat:@"%02d",seconds]; if (seconds==0) { UIAlertView *pAlert = [[UIAlertView alloc]initWithTitle:@"Sorry!!" message:@"TimeOver" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Cancel",nil]; [pAlert show]; [pAlert release]; } } 在Viewdidload中,我通过计时器来调用它。 countDown=[NSTimer scheduledTimerWithTimeInterval:5.0 target:self selector:@selector(TimeOver) userInfo:nil repeats:YES]; 请任何人指导我如何在两分钟内做到这一点。

上传使用backgroundSessionConfiguration和NSURLSessionUploadTask导致应用程序崩溃

我尝试使用NSURLSessionUploadTask新的花哨的iOS 7背景上传,它似乎工作时,我用defaultSessionConfiguration运行,但一旦我尝试backgroundSessionConfiguration它崩溃在我调用uploadTaskWithRequest的行: 下面是代码示例。 奇怪的是,虽然网上有无数的downloadTaskWithRequest例子,但我找不到一个将背景和上传结合在一起的例子。 //Create a session w/ background settings NSURLSessionConfiguration *config = [NSURLSessionConfiguration backgroundSessionConfiguration:@"identifierString.foo"]; NSURLSession *upLoadSession = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil]; //Create a file to upload UIImage *image = [UIImage imageNamed:@"onboarding-4@2x.png"]; NSData *imageData = UIImagePNGRepresentation(image); NSFileManager *fileManager = [NSFileManager defaultManager]; NSArray *URLs = [fileManager URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask]; NSString *documentsDirectory = [[URLs objectAtIndex:0] absoluteString]; NSString *filePath […]

UIScrollView自定义分页

我的问题与我正在尝试使用滚动器的自定义分页forms有关,如果您首先考虑在老虎机中实现的滚动视图的types,则更容易可视化。 所以说我的UIScrollView有100像素的宽度。 假设它包含3个内部视图,每个视图的宽度为30个像素,使得它们以3个像素的宽度分隔。 我想实现的分页types是,每个页面是我的意见(30像素)之一,而不是滚动视图的整个宽度。 我知道,通常,如果视图占用整个滚动视图的宽度,并启用分页,那么一切正常。 但是,在我的自定义分页中,我也希望滚动视图中的周围视图也可见。 我将如何做到这一点?

用iOS 6 SDK和Xcode 4.5构buildarmv6架构(目标iOS 3.1.3)?

有没有机会使用iOS 6 SDK开发针对iOS 3.1.3的应用程序? 如果我用旧的部署目标打开我的项目,编译器会警告我: iOS deployment targets lower than 4.3 are not supported 这可能是由于显然只有armv7和armv7s二进制文件可以build立的事实。 如果我手动添加armv6 (在设备上工作,直到iPhone 3G),还有几个警告: warning: no rule to process file '$(PROJECT_DIR)/main.m' of type sourcecode.c.objc for architecture armv6 … … warning: architecture armv6 is not supported (current ARCHS = "armv6 armv7 armv7s"). 那我该如何处理呢? 有没有办法在使用iOS 6 SDK进行开发时支持iOS 3.1.3? 如果没有,我最终将不得不移动到iOS 4.3的最低目标。 是否可以提交仅支持版本> = 4.3的新版本? […]

如何通过SwiftyJson和Alamofire发布嵌套的json?

如何通过SwiftyJson和Alamofire发布嵌套的json,如下所示(Swift 3) { "a":{ "a1": "v1", "a2": "v2" }, "b":"bv" } 我使用alamofire检查了很多post的Json post嵌套对象 , 如何使用Alamofire和SwiftyJSON访问嵌套的JSON值? , Alamofire JSON对象和集合的序列化和…但他们都没有帮助这种情况。