我有一个不同的UIStoryboard UIViewControllers,我想添加另一个UIViewController(如仪表板),当用户从左侧滑动ipad时,仪表板会出现,然后当他向后滑动时,当前视图将被恢复.
这可能吗?如果是的话有什么提示怎么做或任何好的教程UIGestureRecognizer?
谢谢.
objective-c uiviewcontroller uigesturerecognizer ios swipe-gesture
有一种NSString方法-characterAtIndex:可以返回一个unichar.
- (单字符)characterAtIndex:(NSUInteger)指数
我想知道这个unichar,显然不是一个NSString,可以转换成一个NSString或者NSString用于比较目的吗?
并且:NSString内部是否只包含一系列unichar项目?
我想在当前视图上以模态方式呈现具有略微透明背景的视图控制器,这样第一个视图在模态视图下稍微可见.
我设置模态视图控制器的alpha值并设置modalPresentationStyle为UIModalPresentationCurrentContext,如另一篇文章中所建议的那样.
结果是视图背景在动画制作时是透明的,但是当视图控制器就位时,它会变为不透明的黑色.它可以恢复透明,同时激活解雇.
如何在活动时让它变得透明?
我已经测试过了iOS 6 and 7.我使用的代码如下:
MyModalViewController *viewController = [[MyModalViewController alloc] init];
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
[navController setNavigationBarHidden:YES];
self.navigationController.modalPresentationStyle = UIModalPresentationCurrentContext;
[self.navigationController presentViewController:navController animated:YES completion:NULL];
Run Code Online (Sandbox Code Playgroud) uiviewcontroller uinavigationcontroller modalviewcontroller ios
我正在进行项目,我想让我的应用程序与IOS7兼容.
self.contentSizeForViewInPopover = CGSizeMake(90, 1 * 65 - 1);
Run Code Online (Sandbox Code Playgroud)
此方法已从ios7弃用
新方法是 self.preferredContentSize= CGSizeMake(90,1*65-1);
但我没有得到适当的用户界面
但是当我使用ios7兼容方法进行更改时,我的观点是这样的
使用ios7方法我得到了这个

我可以让UIPinchGestureRecognizer处理程序使用缩放对象,但我不想扩展我想改变大小.例如,我有一个UITextView,我已经附加了一个UIPinchGestureRecognizer手势,如果用户捏,我想更改textview的宽度以匹配捏.我不想缩放它以便UITextView更大(缩放).
我想用谷歌地图显示使用MKMapview的 3D建筑
所需的Mapview显示3d建筑:
我现在的地图就像
我已经设定 _mapView.showsBuildings =YES;
码:
CLLocationCoordinate2D ground = CLLocationCoordinate2DMake(53.58448, -8.93772);
CLLocationCoordinate2D eye = CLLocationCoordinate2DMake(53.58448, -8.93772+.0020);
MKMapCamera *mapCamera = [MKMapCamera cameraLookingAtCenterCoordinate:ground
fromEyeCoordinate:eye
eyeAltitude:3300];
_mapView.camera.pitch = 10;
_mapView.showsBuildings =YES;
_mapView.pitchEnabled = YES;
_mapView.showsPointsOfInterest = YES;
_mapView.zoomEnabled = YES;
_mapView.scrollEnabled = YES;
_mapView.showsUserLocation = NO;
_mapView.camera = mapCamera;
Run Code Online (Sandbox Code Playgroud) 我使用AVPlayerViewController的AVKit框架,直接在横向模式下播放视频。我想知道如何显示字幕。我进行了搜索,但没有找到任何解决方案。我曾经MPMoviePlayerViewController用来播放视频,但是由于它在IOS 9和更高版本中已贬值,因此我正在使用来实现相同的功能AVKit。
NSURL *videoURL = [NSURL URLWithString:video.videoLink];
AVPlayer *newPlayer = [AVPlayer playerWithURL:videoURL];
AVPlayerViewController *playerViewController = [AVPlayerViewController new];
playerViewController.player = newPlayer;
int32_t timeScale = newPlayer.currentItem.asset.duration.timescale;
CMTime seektime=CMTimeMakeWithSeconds(startPlayBackTime, timeScale);
[playerViewController.player seekToTime:seektime toleranceBefore:kCMTimeZero toleranceAfter:kCMTimeZero];
}
[playerViewController.player play];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(playerItemDidReachEnd:)
name:AVPlayerItemDidPlayToEndTimeNotification
object:[newPlayer currentItem]];
playerViewController.player.closedCaptionDisplayEnabled = YES;
[self presentViewController:playerViewController animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
它工作正常,但问题是我无法显示字幕。我发现很少有字幕示例,但所有示例都AVPlayer用作子视图,因此这些方法对我不起作用。
知道如何实现吗?
谢谢 !!
GSSendEvent 对我不起作用了.
即使订阅回调函数GSEventRegisterEventCallBack也不会触发触摸事件,[UIEvent _gsEvent]返回NULL.
发生了什么?
我有一个UIPageViewController视图控制器包含一个UIScrollView包含一个UIImageView.在加载的视图控制器中viewWillAppear,如果旋转视图,则边界不正确.这就是我试图动态地基于根据所述图像的尺寸的图像视图定位此.我试图使用,(void)viewDidLayoutSubviews但我需要调用[self.view layoutSubviews]或我得到一个断言错误.当我添加它,然后我不能再缩放图像视图.您可以看到它尝试缩放但调整大小到最小缩放.
我对自动布局完全不熟悉,并试图看看我是否遗漏了一些东西.
我目前的修复涉及检查框架的边界以查看方向是否与边界匹配.如果是这样,那么我按原样使用边界.如果没有,那么我在计算中切换高度和宽度.
我想知道如何正确使用viewDidLayoutSubviews它而不会剥夺我放大图像视图的能力.
从两个答案中,看起来viewDidLayoutSubviews布局视图可能是错误的地方.我试图找到应该在哪里完成并让视图知道它们的边界和方向,但在它们在屏幕上可见之前.从我的阅读,我认为那是,viewDidLayoutSubviews但似乎使用可能导致无限循环.
objective-c uiscrollview ios uipageviewcontroller autolayout
ios ×6
objective-c ×4
iphone ×3
ios7 ×2
autolayout ×1
avfoundation ×1
avkit ×1
cocoa-touch ×1
dictionary ×1
ipad ×1
jailbreak ×1
mkmapview ×1
pinch ×1
uikit ×1
uiscrollview ×1
xcode ×1
xcode5 ×1