小编iAm*_*iAm的帖子

未知错误[UIWindow endDisablingInterfaceAutorotation]

我收到此错误.我不知道为什么要调用它,谷歌并没有真正帮助.有什么建议?

-[UIWindow endDisablingInterfaceAutorotation] called on <UIWindow: 0x4e0ec50; frame = (0 0; 320 480); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x4e0f9e0>> without matching -beginDisablingInterfaceAutorotation. Ignoring.
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uikit uiwindow

7
推荐指数
3
解决办法
9839
查看次数

iPhone键盘的返回键将光标移动到下一个文本字段

我有一个使用分组样式的TableViewController,有两(2)个部分.第一部分有4行,第二部分有3行.我在每个单元格中放置了一个UILabel和一个UITextField,并且有一个自定义方法(textFieldDone :)来处理按下返回键时光标移动到下一个文本字段.

如果只有一个部分,这工作正常和花花公子,但我有两个:(是的,我需要两个:)

所以我开始编写一个答案,但得到的结果只是不起作用,我在调试期间注意到单元格标识符(我使用两个)只显示一个(在调试控制台中)并且它只是第一个(通用细胞).

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{
    UITableViewCell *cell   = nil;

    switch (indexPath.section) 
    {
        case AUTO_DETAILS:
        {
            static NSString *cellID = @"GenericCell";

            cell = [tableView dequeueReusableCellWithIdentifier:cellID];

            if (cell == nil)
            {
                cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue2 
                                               reuseIdentifier:cellID] autorelease];

                UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 75, 25)];
                label.tag           = kLabelTag;
                label.font          = [UIFont boldSystemFontOfSize:14];
                label.textAlignment = UITextAlignmentRight;
                [cell.contentView addSubview:label];
                [label release];


                UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(90, 12, 200, 25)];
                textField.clearsOnBeginEditing = NO;
                [textField setDelegate:self];
                [textField …
Run Code Online (Sandbox Code Playgroud)

iphone keyboard return cursor textfield

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

Objective-C - 如何从字符串中删除字符?

我有一个UILabel有一个格式化的字符串(格式化为货币),所以有一个美元符号,$ 21.34.

在核心数据实体中,属性是double类型,我使用NSDecimalNumber来保存到数据库.

    self.purchase.name = self.nameTextField.text;
    NSString *string = self.amountLabel.text
    NSDecimalNumber *newAmount = [[NSDecimalNumber alloc] initWithString:string];
    NSLog(@"%@", string); // THIS RETURNS NaN, because of dollar sign i think

    NSManagedObjectContext *context = self.purchase.managedObjectContext;

    NSError *error = nil;
    if (![context save:&error]) 
    {
        NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
        abort();
    }
Run Code Online (Sandbox Code Playgroud)

无论如何,我需要这不是NaN,所以我的想法是删除美元符号,但我不知道该怎么做,或者也许有更好的方法来实现我的目标.

iphone formatting objective-c nsdecimalnumber

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