我知道我可以从键盘上的UIKeyboardFrameEndUserInfoKey获取UIKeyboard高度,并在它成为第一响应者时触发keyboardDidShow通知.
但是,我想知道在这些事件之前键盘的预期高度,所以我可以在视图控制器的viewDidLoad上设置某些设计元素.
由于设备正在改变并且新的拼写校正条改变了键盘高度,我不想硬编码高度.
有没有人知道如何从键盘获得预期的高度考虑到它是否有自动纠正等?
我正在尝试使用过滤器表达式进行简单的dynamoDB扫描(此处有文档)
这是我的表达式字符串:
"attribute_exists("my_db_key") AND ("my_db_key" = 1)"
Run Code Online (Sandbox Code Playgroud)
这简单地说明:
"如果my_db_key的值存在且my_db_key EQUALS 1,则在结果中返回"
但它不起作用,我得到一个错误:
Invalid FilterExpression: Syntax error; token: "1", near: "= 1)
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用属性值占位符来表示值,然后在表达式中使用它,但我不想这样做.根据亚马逊的文档,它不是必需的.
那我该怎么做这个简单的表达呢?有没有人有文档的示例或链接?不幸的是,亚马逊的文档没有任何帮助.
注意:我在iOS上用AWSDynamoDBScanInput实现这个,但我的问题是与全局表达式语法有关,所以它应该没关系.
自升级到xcode 7及更高版本以来,xcode的性能非常糟糕.当我点击一个类或滚动代码窗格时,它有时需要30秒才能做出反应,而且我经常需要强制退出xcode并重新启动.
我关闭了源代码控制,我没有使用swift.
我有一个新的macbook pro,8GB内存和一个SSD.我的电脑很快,没有其他性能问题.
-UPDATE-我已经清除了派生数据,并没有使用任何不寻常的插件
有谁知道可能是什么问题?我想一些构建设置导致了这个,但我不知道哪个.
有谁知道是否可以将音频从视频文件中分离出来,例如h.264编码mpeg(或其他此类格式),而不是将音频数据保存到单独的文件,如mp3文件?这与iPhone SDK有关.
任何指向正确方向的人都会非常感激.谢谢.
我想知道是否有许多NSLog()调用会影响应用程序性能或内存.有谁知道这件事吗?
我想在我的应用程序中的每个函数中放置一个NSLog()调用(这很多),以便我可以看到崩溃日志并跟踪问题.
谢谢.
我有一个带有UIButton的UIView(视图B).
我将此视图B添加到主视图边界之外的区域中的主视图(视图A),而不是使用UIView动画为其设置动画.
在UIView动画完成后,View B现在位于View A之上,因此按钮可见,按钮不响应触摸...我以前从未见过这个但是这是我用新的第一个应用程序iOS(iOS 5).有任何想法吗?
提前致谢.
我在一个单独的线程上运行NSURLConnection(我知道它是异步的并且在主线程上运行时工作),但即使我将父线程作为委托传递,它也不会进行委托调用.有谁知道如何做到这一点?
码:
-(void)startConnectionWithUrlPath:(NSString*)URLpath {
//initiates the download connection - setup
NSURL *myURL = [[NSURL alloc] initWithString:URLpath];
myURLRequest = [NSMutableURLRequest requestWithURL:myURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:60];
[myURL release];
//initiates the download connection on a seperate thread
[NSThread detachNewThreadSelector:@selector(startDownloading:) toTarget:self withObject:self];
}
-(void)startDownloading:(id)parentThread {
NSAutoReleasePool *pool = [[NSAutoReleasePool alloc] init];
[NSURLConnection connectionWithRequest:myURLRequest delegate:parentThread];
//The delegate methods are setup in the rest of the class but they are never getting called...
[pool drain];
}
Run Code Online (Sandbox Code Playgroud)
编辑*
我需要在一个单独的线程上运行NSURLConnection的原因是因为我在我的iPhone应用程序中下载了一些内容,并且当用户锁定屏幕时下载取消(如果用户只需按下主页按钮并且应用程序进入后台,则继续下载).我理解这是因为我在主线程上异步运行连接,而不是单独的.
我在启动NSURLConnection时也尝试过这段代码(不是在一个单独的线程中):
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:myURLRequest delegate:self startImmediately:NO]; …Run Code Online (Sandbox Code Playgroud) iphone multithreading objective-c nsurlconnection nsurlconnectiondelegate
我正在尝试batchWrite使用DocumentClient一组项目(JSON)中的DynamoDB 执行操作
这是我的代码:
var items = [];
for (i = 0; i < orders.length; i++) {
var ord = orders[i]; //a simple json object
var item = {
'PutRequest': {
'Item' : ord[i]
}
};
items.push(item);
}
var params = {
RequestItems: {
'my_table_name': items
}
};
var docClient = new AWS.DynamoDB.DocumentClient();
docClient.batchWrite(params, function(err, data) {
if (err) {
console.log('There was a problem putting the items in the table');
context.fail(err);
}
else {
console.log('Items updated in …Run Code Online (Sandbox Code Playgroud) 我有一个定制的UISlider,它的轨迹图像有时会消失.它随机发生,当它的父视图控制器被推到可见时(我从未看到它实际上消失).
这是我设置UISlider的代码:
timeSlider = [[UISlider alloc] initWithFrame:CGRectMake(55, 8, 210, 23)];
timeSlider.backgroundColor = [UIColor clearColor];
UIImage *blutrackImg = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"bluetrack" ofType:@"png"]];
UIImage *whitetrackImg = [[UIImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"whitetrack" ofType:@"png"]];
//UIEdgeInsetsMake(top,left,bottom,right)
UIImage *stetchLeftTrack = [blutrackImg stretchableImageWithLeftCapWidth:9.0 topCapHeight:0.0];
UIImage *stetchRightTrack = [whitetrackImg stretchableImageWithLeftCapWidth:9.0 topCapHeight:0.0];
[timeSlider setThumbImage: [UIImage imageNamed:@"whiteslide2.png"] forState:UIControlStateNormal];
[timeSlider setMinimumTrackImage:stetchLeftTrack forState:UIControlStateNormal];
[timeSlider setMaximumTrackImage:stetchRightTrack forState:UIControlStateNormal];
timeSlider.continuous = NO;
[timeSlider addTarget:self action:@selector(trackTime:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:timeSlider];
Run Code Online (Sandbox Code Playgroud)
我在iOS 5.0上构建.有没有人碰到这样的事情?
我正在尝试将 CMSampleBufferRefs 附加到 AVAssetWriterInput 并且我不断遇到错误崩溃:
[AVAssetWriterInput appendSampleBuffer:] status 为 0 时无法调用方法
代码:
在视图中加载
NSArray *cachePaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cacheDirectory = [cachePaths firstObject];
NSString *filename = @"test.mp4";
NSString *filePath = [cacheDirectory stringByAppendingPathComponent:filename];
[[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
NSURL *outputURL = [[NSURL alloc] initFileURLWithPath:filePath];
NSError *errors;
assetWriter = [[AVAssetWriter alloc] initWithURL:outputURL fileType:(NSString *)kUTTypeMPEG4 error:&errors];
videoWriteInput = [[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeVideo outputSettings:outputSettings];
audioWriteInput = [[AVAssetWriterInput alloc] initWithMediaType:AVMediaTypeAudio outputSettings:audioSettings];
[audioWriteInput addTrackAssociationWithTrackOfInput:videoWriteInput type:AVTrackAssociationTypeTimecode];
audioWriteInput.expectsMediaDataInRealTime = YES;
videoWriteInput.expectsMediaDataInRealTime = YES;
Run Code Online (Sandbox Code Playgroud)
记录功能
-(void)prepareVideo {
if (![assetWriter startWriting]) …Run Code Online (Sandbox Code Playgroud) iphone ×7
ios ×3
performance ×2
video ×2
animation ×1
audio ×1
expression ×1
height ×1
image ×1
ipad ×1
javascript ×1
keyboard ×1
node.js ×1
nslog ×1
objective-c ×1
recorder ×1
uibutton ×1
uikeyboard ×1
uislider ×1
uiview ×1
xcode ×1