我需要移动光标以在文本字段上的设置焦点上开始文本位置.有可能吗?
我整合了最新版本的Google AnalyticsSDK.我在我的应用程序中使用静默通知.所以我需要一点时间来完成后台任务(大约30秒).我看到许多崩溃与允许的时间有关.
My App[3114] has active assertions beyond permitted time:
{(
<BKProcessAssertion: 0x15699c00> identifier: Background Content Fetching (15) process: MyApp [3114] permittedBackgroundDuration: 30.000000 reason: backgroundContentFetching owner
pid:3101 preventSuspend preventThrottleDownUI preventIdleSleep preventSuspendOnSleep
)}
Run Code Online (Sandbox Code Playgroud)
我看到应用程序在[GAI threadMain]上崩溃了以下堆栈:
Thread 2:
0 libsystem_kernel.dylib 0x3b47ca58 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x3b47c854 mach_msg + 44
2 CoreFoundation 0x3074c896 __CFRunLoopServiceMachPort + 150
3 CoreFoundation 0x3074afbc __CFRunLoopRun + 780
4 CoreFoundation 0x306b5f0a CFRunLoopRunSpecific + 518
5 CoreFoundation 0x306b5cee CFRunLoopRunInMode + 102
6 Foundation 0x310a81e6 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7 …
Run Code Online (Sandbox Code Playgroud) 是否可以检查应用程序使用推送通知api?我从应用中删除了推送通知,但我的应用被拒绝并发出以下警告:
缺少推送通知权利 - 您的应用似乎包含用于向Apple推送通知服务注册的API,但应用签名的权利不包括"aps-environment"权利.如果您的应用使用Apple推送通知服务,请确保在配置门户中为推送通知启用了您的应用ID,并在使用包含"aps-environment"权利的配置配置文件对应用进行签名后重新提交.有关详细信息,请参阅"本地和推送通知编程指南"中的"供应和开发".如果您的应用不使用Apple推送通知服务,则无需执行任何操作.您可以从将来的提交中删除API以停止此警告.如果您使用第三方框架,则可能需要与开发人员联系以获取有关删除API的信息.
所以据我所知,我应该:
如果您的应用不使用Apple推送通知服务,则无需执行任何操作.您可以从将来的提交中删除API以停止此警告.
有可能检查api吗?
我需要插入到UILabel
多行文本.我做以下事情:
NSMutableString * spName = [[NSMutableString alloc ]initWithString:@""];
for (NSUInteger i=0; i<arrEx.count; ++i)
{
ExInfo * exInf = [arrEx objectAtIndex:i];
[spName appendString:[MyObject getName:exInf.spNum]];
[spName appendString:@" "];
[spName appendString:exInf.totalTime];
[spName appendString:@"\n"];
}
CGSize size = [spName sizeWithFont:[UIFont systemFontOfSize:14]
constrainedToSize:constraint
lineBreakMode:UILineBreakModeWordWrap];
[cell.exsInfoLabel setFrame:CGRectMake(CELL_CONTENT_MARGIN, top, CELL_CONTENT_WIDTH - (CELL_CONTENT_MARGIN * 2), size.height)];
[cell.exsInfoLabel setText:spName];
[spName release];
Run Code Online (Sandbox Code Playgroud)
arrEx
由两个项组成,所以它应该是两个字符串.但是UITableViewCell
只包含第一个字符串.在IB中,我将UILabel的行数设置为0 cell.exsInfoLabel
.
我的类方法中有以下代码用于测试:
NSMutableDictionary * temp = [[NSMutableDictionary alloc] init];
[temp setObject:@"4" forKey:@"Interval"];
interval = [temp objectForKey:@"Interval"];
[temp release];
Run Code Online (Sandbox Code Playgroud)
interval是我的实例变量:
NSString * interval;
Run Code Online (Sandbox Code Playgroud)
和getter方法(它不是属性):
- (NSString *) getInterval {
return interval;
}
Run Code Online (Sandbox Code Playgroud)
在其他一些类中,我试图使用方法getInterval,如下所示:
NSString * test = [MyObject getInterval];
Run Code Online (Sandbox Code Playgroud)
getInterval返回正确的4值,我在调试器中看到它.我无法理解,因为据我所知,使用NSMutableDictionary temp时,指向interval实例变量的指针应该是空闲的.为什么会这样?
我需要从NSString获取url字符串.我做以下事情:
NSString * str = [NSString stringWithString:@"i@gmail.com"];
NSString * eStr = [str stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSLog(@"%@",eStr);
Run Code Online (Sandbox Code Playgroud)
结果是i@gmail.com.但我需要i%40gmail.com.用NSASCIIStringEncoding替换NSUTF8StringEncoding没有帮助.
我需要在组合框项目的底部添加"选择更多...",就像在SQL 2008服务器选择器上完成一样.试试这样:
List<string> srvList = new List<string>();
srvList.Add("ff");
srvList.Add("jj");
srvList.Add("pp");
srvList.Add("<Select more...>");
ComboBoxServs.Items.AddRange(srvList.ToArray<String>());
Run Code Online (Sandbox Code Playgroud)
但是"选择更多..."会出现在项目的顶部.
我创建了这样的自定义导航按钮:
UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:[UIImage imageNamed:@"some.png"] forState:UIControlStateNormal];
....
[[current navigationItem] setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithCustomView:button]];
Run Code Online (Sandbox Code Playgroud)
其中current是UIViewController*类型.一切正常,按钮创建,但它是按钮外的可点击区域,非常靠近导航栏的中间.是否可以限制可点击区域?
我添加了通知我的UIViewController进行捕获
- (void)applicationWillResignActive:(UIApplication *)application:
Run Code Online (Sandbox Code Playgroud)
像这样
- (void)viewDidLoad {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:)
name:APP_RESIGN_ACTIVE_NOTIFICATION object:nil];
Run Code Online (Sandbox Code Playgroud)
它工作正常,但如果我显示其他控制器:
[self presentViewController:[[UINavigationController alloc] initWithRootViewController:view]
animated:YES
completion:nil];
Run Code Online (Sandbox Code Playgroud)
通知停止工作.我只删除了通知
- (void)viewDidUnload {
[super viewDidUnload];
[[NSNotificationCenter defaultCenter] removeObserver:self name:APP_RESIGN_ACTIVE_NOTIFICATION object:nil];
Run Code Online (Sandbox Code Playgroud)
但是当我显示模态控制器时它没有被调用.
我找到了如何将秒转换为11:00:30.1格式,但无法找到如何将格式为11:00:30.1的小时转换为秒.请给我一些链接.
我有一个带有以下对象的NSMutableArray:
@interface MyViewCell : UITableViewCell {
NSUInteger id;
.....
}
Run Code Online (Sandbox Code Playgroud)
在某些方法中,我需要快速搜索具有预定义id的单元格.怎么做到最好?
objective-c ×6
ios ×5
background ×1
c# ×1
combobox ×1
nsstring ×1
uikit ×1
uilabel ×1
uitextfield ×1
winforms ×1
xcode ×1