我刚刚更新到Xcode 4.
通常在本地化应用程序时,我们将"Localizable.String"文件添加到项目中,然后导航到"获取信息"菜单并单击"使其本地化"按钮.
但是,在Xcode 4中,没有"获取信息"菜单.
当我尝试添加语言时,它只会影响"InfoPlist.String"文件(只能本地化应用程序的名称).
如何在Xcode 4中为我的应用添加本地化?
http://jsfiddle.net/nicktheandroid/tVHYg/
当悬停时.wrapper
,它的子元素.contents
应该从0px
它的自然宽度动画.然后当鼠标移开时.wrapper
,它应该动画回来0px
.该.wrapper
元件应仅一样宽,它需要被(允许.contents
成长),所以.wrapper
在宽度要长,宽度收缩为.contents
一样.应该没有设置的宽度.contents
.我正在使用CSS3,但它可以在jQuery中完成,这很好.
问题: 看看JSfiddle
.wrapper
不仅需要它的宽度..contents
它增长时,当它几乎达到它的全宽时,它会跳到下一行.wrapper
,.contents
消失,当它应该动画下来0px
.wrapper {
display: inline-block;
height: 20px;
width: auto;
padding:10px;
background:#DDD;
}
.contents {
display:inline-block;
width:0%;
white-space:nowrap;
overflow:hidden;
background:#c3c;
}
.wrapper:hover .contents {
-webkit-transition: width 1s ease-in-out;
-moz-transition: width 1s ease-in-out;
-o-transition: width 1s ease-in-out;
transition: width 1s ease-in-out;
width:100%;
}
Run Code Online (Sandbox Code Playgroud)
<div class="wrapper">
<span>+</span>
<div class="contents">These …
Run Code Online (Sandbox Code Playgroud)我如何才能找到indexPath
用于cell
在中间UICollectionView
?
我有水平滚动,只有一个大cell
的可见(cell
两侧的其他部分也是可见的).我需要删除cell
位于中心(手段 - 当前cell
)而不触摸它.
只需按"废纸篓"按钮并确认删除.但现在它只删除了第一个cell
s.
- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex == actionSheet.destructiveButtonIndex) {
initialPinchPoint = ????????
self.tappedCellPath = [self.collectionView indexPathForItemAtPoint:initialPinchPoint];
Technique *technique = [arrayOfTechnique objectAtIndex:self.tappedCellPath.row];
[self deleteData:[NSString stringWithFormat:@"DELETE FROM TECHNIQUES WHERE TECHNIQUENAME IS '%s'",[technique.techniquename UTF8String]]];
[arrayOfTechnique removeObjectAtIndex:self.tappedCellPath.row];
//[arrayOfTechnique removeObjectAtIndex:[custom_layout ]];
[self removeImage:technique.techniquename];
[self.collectionView performBatchUpdates:^{
[self.collectionView deleteItemsAtIndexPaths:[NSArrayarrayWithObject:self.tappedCellPath]];
} completion:nil];
[self checkArrayCount];
}
}
Run Code Online (Sandbox Code Playgroud) 我想发送JSON
一个URL(POST
和GET
).
NSMutableDictionary *JSONDict = [[NSMutableDictionary alloc] init];
[JSONDict setValue:"myValue" forKey:"myKey"];
NSData *JSONData = [NSJSONSerialization dataWithJSONObject:self options:kNilOptions error:nil];
Run Code Online (Sandbox Code Playgroud)
我当前的请求代码无效.
NSMutableURLRequest *requestData = [[NSMutableURLRequest alloc] init];
[requestData setURL:[NSURL URLWithString:@"http://fake.url/"];];
[requestData setHTTPMethod:@"POST"];
[requestData setValue:postLength forHTTPHeaderField:@"Content-Length"];
[requestData setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
[requestData setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[requestData setHTTPBody:postData];
Run Code Online (Sandbox Code Playgroud)
使用ASIHTTPRequest
是不是一个容易回答.
我有一个程序,我想使用谷歌地图.问题是我得到一个错误,表示a为null,其中a是google map api中使用的var.以下是我调用谷歌地图的方式:
//Creates a new center location for the google map
var latlng = new google.maps.LatLng(centerLatitude, centerLongitude);
//The options for the google map
var myOptions = {
zoom: 7,
maxZoom: 12,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
//Creates the new map
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
Run Code Online (Sandbox Code Playgroud)
这是我的HTML标记的样子:
<div id = "map_canvas"></div>
Run Code Online (Sandbox Code Playgroud)
我通过网址获取页面加载的lat和lng.这些值正确传递,所以我知道这不是问题.我认为这与var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
不正确有关.有什么建议?
编辑:这是错误消息:
a从nullLngToPoint(a = null)yg(a = null,b = Object {zoom = 7,maxZoom = 12,more ...})d(d = Document Default.aspx?lat = 30.346317&lng = …
我需要找到我当前的位置CoreLocation
,我尝试了多种方法,但到目前为止我CLLocationManager
只返回0 ..(0.000.00.000
).
这是我的代码(更新后工作):
进口:
#import <CoreLocation/CoreLocation.h>
Run Code Online (Sandbox Code Playgroud)
宣布:
IBOutlet CLLocationManager *locationManager;
IBOutlet UILabel *latLabel;
IBOutlet UILabel *longLabel;
Run Code Online (Sandbox Code Playgroud)
功能:
- (void)getLocation { //Called when needed
latLabel.text = [NSString stringWithFormat:@"%f", locationManager.location.coordinate.latitude];
longLabel.text = [NSString stringWithFormat:@"%f", locationManager.location.coordinate.longitude];
}
- (void)viewDidLoad {
locationManager = [[CLLocationManager alloc] init];
locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters; // 100 m
[locationManager startUpdatingLocation];
}
Run Code Online (Sandbox Code Playgroud) 在诸如如何绘制一个平滑的圆圈......,...绘制圆...和...绘制填充圆圈的问题和答案是非常广泛的,包含许多不必要的步骤,并使用的方法并不总是最容易重新创建或管理.
什么是绘制圆圈并将其添加到我的简单方法UIView
?
如何将"对象"添加到现有应用程序?
例如,EasyRefresh for Chrome调整,在iOS Chrome应用程序中启用了一个新按钮,就像许多其他调整一样.
我怎么可以添加一个简单UIButton
的,例如,Twitter应用程序?
是否有任何GitHub项目可以帮助我理解它是如何完成的?
图像来源:ModMyI
谢谢.
我想知道我何时AVAudioRecorder
无法进入(例如音乐开始播放时).
正如audioRecorderEndInterruption
将在iOS 9中弃用的那样,我专注于AVAudioSession
中断通知(但两者都没有按预期工作).
问题是,如果应用程序在中断发生时仍然在前台,则永远不会调用中断通知.
例如:用户启动和停止播放音乐而不将应用程序移动到后台.
要检测我正在使用的任何中断:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(audioSessionWasInterrupted:) name:AVAudioSessionInterruptionNotification object:nil];
...
- (void)audioSessionWasInterrupted:(NSNotification *)notification {
if ([notification.name isEqualToString:AVAudioSessionInterruptionNotification]) {
NSLog(@"Interruption notification");
if ([[notification.userInfo valueForKey:AVAudioSessionInterruptionTypeKey] isEqualToNumber:[NSNumber numberWithInt:AVAudioSessionInterruptionTypeBegan]]) {
NSLog(@"InterruptionTypeBegan");
} else {
NSLog(@"InterruptionTypeEnded");
}
}
}
Run Code Online (Sandbox Code Playgroud)
我InterruptionTypeBegan
按预期得到了,但InterruptionTypeEnded
如果应用程序仍在前台,则不会被调用(意味着在将应用程序放置在后台并返回到前台之前不会调用它).
InterruptionTypeEnded
当应用程序在前台时发生中断时,我如何收到通知?
我MyApp
在iOS模拟器(Xcode 7,iOS 9)上使用安装xcrun simctl install booted MyPath/MyApp.app
.
这按预期工作,应用程序安装在模拟器上.
但是,手动或使用xcrun simctl launch booted com.company.MyApp
失败启动应用程序.回馈错误:
处理命令时遇到错误(domain = FBSOpenApplicationErrorDomain,code = 1):无法完成操作.(FBSOpenApplicationErrorDomain错误1.)
该应用程序从Xcode导出(请注意,从Xcode运行应用程序或从其源代码重新构建应用程序不是一个负责任的解决方案).
这不是应用程序特定的,因为以这种方式安装的任何应用程序崩溃都会出现相同的错误.
系统日志报告相同的错误,但有一些其他信息.
com.apple.CoreSimulator.SimDevice.CA35ED48-DDAA-4CF0-8C69-C206CC55A6EB.launchd_sim [4200](UIKitApplication:com.company.MyApp [0xe9ec] [4281]):服务指定的程序不包含所请求的架构之一:R
SpringBoard [4217]:无法获取'UIKitApplication:com.company.MyApp [0xe9ec]'的pid:没有这样的进程(错误3)
SpringBoard [4217]:Bootstrapping失败了
SpringBoard [4217]:应用程序'UIKitApplication:com.company.MyApp [0xe9ec]'自愿退出.
SpringBoard [4217]:CGContextSaveGState:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.
SpringBoard [4217]:CGContextTranslateCTM:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.
SpringBoard [4217]:CGContextRestoreGState:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.
SpringBoard [4217]:CGContextSaveGState:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.
SpringBoard [4217]:CGContextTranslateCTM:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.
SpringBoard [4217]:CGContextRestoreGState:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.
com.apple.CoreSimulator.SimDevice.CA35ED48-DDAA-4CF0-8C69-C206CC55A6EB.launchd_sim [4200](UIKitApplication:com.company.MyApp [0xc82f] [4282]):服务指定的程序不包含所请求的架构之一:R
SpringBoard [4217]:无法获取'UIKitApplication:com.company.MyApp [0xc82f]'的pid:没有这样的进程(错误3)
SpringBoard [4217]:Bootstrapping失败了
SpringBoard [4217]:应用程序'UIKitApplication:com.company.MyApp [0xc82f]'自愿退出.
该architectures
错误改变变量.R,f等
造成这个问题的原因是什么?我该如何解决?
ios ×4
xcode ×3
objective-c ×2
swift ×2
avfoundation ×1
cashapelayer ×1
css ×1
css3 ×1
get ×1
google-maps ×1
installation ×1
interrupt ×1
jailbreak ×1
javascript ×1
jquery ×1
localization ×1
location ×1
nsurlsession ×1
post ×1
tampering ×1
tweak ×1
uibezierpath ×1
xcode4 ×1
xcode7 ×1
xcrun ×1