小编Ale*_*izi的帖子

如何使用Xcode 4本地化我的应用程序?

我刚刚更新到Xcode 4.

通常在本地化应用程序时,我们将"Localizable.String"文件添加到项目中,然后导航到"获取信息"菜单并单击"使其本地化"按钮.

但是,在Xcode 4中,没有"获取信息"菜单.

当我尝试添加语言时,它只会影响"InfoPlist.String"文件(只能本地化应用程序的名称).

如何在Xcode 4中为我的应用添加本地化?

xcode localization internationalization xcode4

66
推荐指数
3
解决办法
5万
查看次数

将元素的宽度设置为0到100%的动画,并且它的包装器只有它们需要的宽度,没有预先设置的宽度,在CSS3或jQuery中

http://jsfiddle.net/nicktheandroid/tVHYg/

当悬停时.wrapper,它的子元素.contents应该从0px它的自然宽度动画.然后当鼠标移开时.wrapper,它应该动画回来0px.该.wrapper元件应仅一样宽,它需要被(允许.contents成长),所以.wrapper在宽度要长,宽度收缩为.contents一样.应该没有设置的宽度.contents.我正在使用CSS3,但它可以在jQuery中完成,这很好.

问题: 看看JSfiddle

  1. .wrapper 不仅需要它的宽度.
  2. .contents它增长时,当它几乎达到它的全宽时,它会跳到下一行
  3. 当它徘徊时.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)

css jquery css3 css-transitions

51
推荐指数
4
解决办法
19万
查看次数

如何获取位于UICollectionView中心的单元格的indexPath

我如何才能找到indexPath用于cell在中间UICollectionView

我有水平滚动,只有一个大cell的可见(cell两侧的其他部分也是可见的).我需要删除cell位于中心(手段 - 当前cell)而不触摸它.

只需按"废纸篓"按钮并确认删除.但现在它只删除了第一个cells.

- (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)

ios uicollectionview uicollectionviewcell

49
推荐指数
6
解决办法
4万
查看次数

如何发送POST和GET请求?

我想发送JSON一个URL(POSTGET).

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不是一个容易回答.

post get objective-c nsurlsession swift

45
推荐指数
1
解决办法
9万
查看次数

Google地图错误:a为空

我有一个程序,我想使用谷歌地图.问题是我得到一个错误,表示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 = …

javascript google-maps

44
推荐指数
4
解决办法
7万
查看次数

如何使用CoreLocation查找当前位置

我需要找到我当前的位置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)

xcode location core-location cllocationmanager

34
推荐指数
2
解决办法
8万
查看次数

使用CAShapeLayer绘制圆的简单方法

在诸如如何绘制一个平滑的圆圈......,...绘制圆......绘制填充圆圈的问题和答案是非常广泛的,包含许多不必要的步骤,并使用的方法并不总是最容易重新创建或管理.

什么是绘制圆圈并将其添加到我的简单方法UIView

objective-c cashapelayer ios uibezierpath swift

32
推荐指数
1
解决办法
4万
查看次数

iOS - 将"对象"添加到现有应用程序(越狱)

如何将"对象"添加到现有应用程序?

例如,EasyRefresh for Chrome调整,在iOS Chrome应用程序中启用了一个新按钮,就像许多其他调整一样.

我怎么可以添加一个简单UIButton的,例如,Twitter应用程序?

是否有任何GitHub项目可以帮助我理解它是如何完成的?


图片

图像来源:ModMyI


谢谢.

tweak jailbreak tampering ios

21
推荐指数
2
解决办法
7282
查看次数

iOS AVAudioSession中断通知无法按预期工作

我想知道我何时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当应用程序在前台时发生中断时,我如何收到通知?

interrupt avfoundation avaudiorecorder ios avaudiosession

18
推荐指数
1
解决办法
1万
查看次数

手动安装在模拟器中的应用程序在加载时崩溃

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等

造成这个问题的原因是什么?我该如何解决?

installation xcode ios-simulator xcrun xcode7

16
推荐指数
2
解决办法
6733
查看次数