我有这个子视图我想添加到我的主视图,但让它从原点扩展.我阅读了一些Apple文档,但我不明白我在哪里弄错了.我可以为框架的原点设置动画,即让它从任何地方滑入,但宽度/高度似乎没有动画.代码如下:
[UIView beginAnimations:@"animateAddContentView" context:nil];
[UIView setAnimationDuration:0.4];
customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 0, 150);
[self.view addSubview:customView];
customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 310, 150);
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
我也试过在动画中只放置setFrame部分,如下所示:
customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 0, 150);
[self.view addSubview:customView];
[UIView beginAnimations:@"animateAddContentView" context:nil];
[UIView setAnimationDuration:0.4];
customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 310, 150);
[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)
但它仍然不起作用!
编辑:
根据建议,我已将其移至基于块的动画解决方案,这是确切的代码:
NSLog(@"yourview : %@",customView);
customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y +5, 0, 150);
NSLog(@"yourview : %@",customView);
[self.view addSubview:customView];
NSLog(@"yourview : %@",customView);
// [customView setFrame:CGRectMake( 0.0f, 480.0f, customView.frame.size.width, customView.frame.size.height)];
[UIView animateWithDuration:0.4
delay:0
options:UIViewAnimationCurveEaseInOut …
Run Code Online (Sandbox Code Playgroud) 现在我正在使用注释填充地图视图,并显示用户的当前位置.使用viewForAnnotation方法,它会使用默认的红色引脚覆盖所有注释,但我想返回其他注释的视图,但将用户位置保留为默认的蓝色信标.有没有办法简单地执行此操作,还是必须创建新的注释视图并根据注释返回正确的注释视图?
现在我有类似的东西:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
if (annotation.coordinate == locationManager.location.coordinate) {
return nil;
}else {
MKAnnotationView *annotationView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"Beacon"];
// Button
UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure];
button.frame = CGRectMake(0, 0, 23, 23);
annotationView.rightCalloutAccessoryView = button;
annotationView.canShowCallout = YES;
return annotationView;
}
}
Run Code Online (Sandbox Code Playgroud)
但我无法将两者等同起因为我无法从注释参数中获取坐标属性.
有人知道任何解决方案吗?
在最近更新到Mavericks 10.9.5之后,我的ffmpeg安装一直在讨论
错误:
dyld: Library not loaded: /usr/local/lib/libx264.142.dylib
Referenced from: /usr/local/bin/ffmpeg
Reason: image not found
Trace/BPT trap: 5
Run Code Online (Sandbox Code Playgroud)
有什么想法吗?我不熟悉手动编译,我通过Homebrew安装了ffmpeg.
我尝试卸载并执行:
brew install ffmpeg --HEAD
brew install ffmpeg --build-from-source
Run Code Online (Sandbox Code Playgroud)
但它吐出了一个./configure错误
==> ./configure --prefix=/usr/local/Cellar/ffmpeg/2.4.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced …
Run Code Online (Sandbox Code Playgroud) 我有一个像@"random ++ qwerty/asdf"的字符串,我想要删除qwerty部分."random ++"和"/ asdf"将始终相同.我将如何使用正则表达式执行此操作?我很困惑他们的工作方式.
我使用以下代码从CLGeocoder接收地标,我想在同一个viewcontroller上只显示另一个textview中的城市.我如何从这个阵列中解析出这座城市?它不是NSDictionary或任何东西,所以我不知道该怎么做.
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
[geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(@"reverseGeocodeLocation:completionHandler: Completion Handler called!");
if (error){
NSLog(@"Geocode failed with error: %@", error);
return;
}
NSLog(@"Received placemarks: %@", placemarks);
}];
Run Code Online (Sandbox Code Playgroud)
我给定地标的日志如下:
<__ NSArrayM 0x1a0b3810>(937-961 Sunnyvale Saratoga Rd,937-961 Sunnyvale Saratoga Rd,Sunnyvale,CA 94087,United States @ + + 37.35984860,-122.03235910> +/- 100.00m)
要么
<__ NSArrayM 0x19576ac0>(5600 Van Nuys Blvd,5600 Van Nuys Blvd,Van Nuys,CA 91401-4602,United States @ <+ 34.17257000,-118.44794450> +/- 100.00m,region(identifier <+ 34.17257001,-118.44794464> radius 57.64)<+ 34.17257001,-118.44794464>半径57.64m)
我如何才能将Sunnyvale或Van Nuys的部分显示为字符串?