iPad Air有一个奇怪的问题!,我的代码在iPad 3,iPad 4,iPhone 5S,iPod 5th Gen上运行良好,但在iPad上,我的图像自动滚动而无需用户旋转设备,这是我的代码:
@property (strong, nonatomic) CMMotionManager *motionManager;
self.mainScrollView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
self.mainScrollView.bounces = NO;
self.mainScrollView.userInteractionEnabled = NO;
//set up the image view
UIImage *image= [UIImage imageNamed:@"YOUR_IMAGE_NAME"];
UIImageView *movingImageView = [[UIImageView alloc]initWithImage:image];
[self.mainScrollView addSubview:movingImageView];
self.mainScrollView.contentSize = CGSizeMake(movingImageView.frame.size.width, self.mainScrollView.frame.size.height);
self.mainScrollView.contentOffset = CGPointMake((self.mainScrollView.contentSize.width - self.view.frame.size.width) / 2, 0);
//inital the motionManager and detec the Gyroscrope for every 1/60 second
//the interval may not need to be that fast
self.motionManager = [[CMMotionManager alloc] init];
self.motionManager.gyroUpdateInterval = 1/60; …Run Code Online (Sandbox Code Playgroud) 我正在以UIToolbar编程方式创建,但问题是此工具栏的位置是否向上(导航栏位置).如何将其自动放在底部?
这是我的代码:
CGRect rect2 = CGRectMake(0, toolBar.frame.origin.y , self.view.frame.size.width , 0);
toolBar = [[UIToolbar alloc]initWithFrame:rect2];
toolBar.barStyle = UIBarStyleBlackTranslucent;
[toolBar sizeToFit];
[self.view addSubview:toolBar];
[toolBar release];
Run Code Online (Sandbox Code Playgroud)
因为我的应用程序是通用的,我的视图控制器类没有任何nib文件我需要为iPad和iPhone定义它,我不想使用UIUserInterfaceIdiomPad.
我正在开发一个应用程序TvOS并具有与界面生成器的问题,当我拖累状物体Buttons,labels,段等..当前视图显示我什么!只有一个空白矩形,显示该对象的位置和区域
当我运行应用程序对象时会显示正常!
界面构建器有什么问题?
Xcode版本7.1(7B91b),OS X版本:10.11.1(15B42)
在屏幕截图的顶部有一个错误.
"发生内部错误.编辑功能可能受限"
我正在尝试录制音频AVAudioRecorder.我需要创建一个这样的简单波形:
当用户对着麦克风说话时,圆圈表示用户语音的等级.我尝试使用此代码测量语音,但代码未检测到任何缓冲区而无法正常工作:
func levelTimerCallback(timer:Timer) {
//we have to update meters before we can get the metering values
audioRecorder.updateMeters()
//print to the console if we are beyond a threshold value. Here I've used -7
if audioRecorder.averagePower(forChannel: 1) > -7 {
print(" level I'm hearin' you in dat mic ")
print(audioRecorder.averagePower(forChannel: 0))
}
}
Run Code Online (Sandbox Code Playgroud)
录制音频:
func startRecording() {
let audioSession = AVAudioSession.sharedInstance()
do {
// Audio Settings
settings = [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 12000,
AVNumberOfChannelsKey: 1,
AVEncoderAudioQualityKey: AVAudioQuality.high.rawValue
]
audioRecorder …Run Code Online (Sandbox Code Playgroud) 我有一些UILabel默认的系统字体。但是当我在装有 iOS 13.1 的 iPad 或 iPhone 上安装我的应用程序时,字体会变成类似Times New Roman! 为什么会发生这种情况?我确定标签的文本是普通的,字体是System. 我该如何解决这个问题?
PS:我已经从苹果网站下载了所有的SF字体,仍然没有运气!
我只是不小心从Xcode proj中删除了一些文件,但我确定我按下了remove reference only按钮,但是我的所有图像都已从我的项目中删除了,我无法在我的硬盘上找到它们,无论如何要恢复这些图像?垃圾中没有图像的迹象!
我试图每30分钟重复一次本地通知,但我的代码不能正常工作......如果你帮助我找到解决方案,我将不胜感激,这是我的代码:
UILocalNotification *reminderNote = [[UILocalNotification alloc]init];
reminderNote.fireDate = [NSDate dateWithTimeIntervalSinceNow:60 * 30];
reminderNote.repeatInterval = NSHourCalendarUnit;
reminderNote.alertBody = @"some text";
reminderNote.alertAction = @"View";
reminderNote.soundName = @"sound.aif";
[[UIApplication sharedApplication] scheduleLocalNotification:reminderNote];
Run Code Online (Sandbox Code Playgroud) 嗨我需要在Instagram中导入我编辑过的图像,比如PhotoStudio:

我使用以下代码捕获了我的图像:
UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0);
[self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
Run Code Online (Sandbox Code Playgroud)
然后我需要screenShot用Instagram 打开它:
编辑:
我实现这样的方法:
UIGraphicsBeginImageContextWithOptions(self.captureView.bounds.size, self.captureView.opaque, 0.0);
[self.captureView.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage * screenshot = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
NSURL *igImageHookFile = [[NSURL alloc] initWithString:[[NSString alloc] initWithFormat:@"file://%@", screenshot]];
docFile.UTI = @"com.instagram.photo";
[self setupDocumentControllerWithURL:igImageHookFile];
NSURL *instagramURL = [NSURL URLWithString:@"instagram://media?id=MEDIA_ID"];
if ([[UIApplication sharedApplication] canOpenURL:instagramURL]) {
[[UIApplication sharedApplication] openURL:instagramURL];
}
else {
NSLog(@"No Instagram Found");
}
}
Run Code Online (Sandbox Code Playgroud)
但是我收到了这个输出:
2012-05-05 21:55:36.842 InstantFrame[855:707] *** Assertion failure in -[UIDocumentInteractionController setURL:], /SourceCache/UIKit/UIKit-1914.84/UIDocumentInteractionController.m:1094
2012-05-05 21:55:36.848 InstantFrame[855:707] …Run Code Online (Sandbox Code Playgroud) 我试图在tvOS应用程序中呈现一个视图控制器,但所包含的代码片段都没有.我错过了什么?
代码1:
DinoViewController *dinoVC = [[DinoViewController alloc]init];
dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:dinoVC animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud)
代码2:
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
DinoViewController *dinoVC = [storyboard instantiateInitialViewController];
dinoVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentViewController:dinoVC animated:YES completion:nil];
Run Code Online (Sandbox Code Playgroud) 我正在尝试更新我的一个项目,当我打开它时,我执行了验证设置,但是当我尝试构建它时,我只是面对这个错误:
Apple Mach-O链接器错误组:clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
没有更多的信息,我没有使用cocoapods或任何外部框架.我只是到处搜索并做了任何可能的解决方案,例如:
等等...
有什么可以解决这个问题吗?
ios ×8
iphone ×7
xcode ×7
ipad ×4
objective-c ×4
tvos ×2
sdk ×1
storyboard ×1
swift ×1
television ×1
uitoolbar ×1