小编Gab*_*ter的帖子

如何让android imageview方块?

ImageView在Android项目中使用了一个.

宽度:match_parent 高度:wrap_content

我将它缩放到了fill_XY,但图像还不是正方形......我该怎么办?

在此输入图像描述

android imageview

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

我可以在视图中添加一个计时器以进入下一个视图吗?

我有一个视图,用户在这个视图中,没有办法消失.有一个广告,比一段时间后出现"go"按钮,或更好,它会自动进入下一个视图!我正在使用故事板.

cocoa-touch ios uistoryboard

5
推荐指数
1
解决办法
3227
查看次数

Is there any way to remove the "year" of the date picker?

I have a date picker in a view, but I only want it to display the days and the months, not the years, is there any way to take the year out?

cocoa-touch objective-c ios

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

不兼容的指针类型分配给'UILabel*__ weak'到'NSString*__ strong'?

我一直在使用objective-c做一件事,但我是这种语言的初学者,这就是我所做的:

有一个名为"firstviewclass"的类,它控制着我的第一个视图,在这个视图中有一个用户输入数字的文本字段.textfield在firstviewclass.h中,名为"setNumber".还有另一个名为"secondviewclass"的类控制着第二个视图,在这个视图中有一个标签位于secondviewclass.h中,我希望这个标签能够重现用户放在文本域中的值.第一个观点.我的代码:

firstviewclass.h:

#import <UIKit/UIKit.h>

@interface firstviewclass : UIViewController

@property (strong, nonatomic) IBOutlet UITextField *setNumber;

- (IBAction)gotonextview:(id)sender;

 @end
Run Code Online (Sandbox Code Playgroud)

secondviewclass.h:

#import <UIKit/UIKit.h>
#import "firstviewclass.h"

@interface secondviewclass : UIViewController

@property (weak, nonatomic) IBOutlet UILabel *labelthatrecivesthetextfieldvalue;

@end
Run Code Online (Sandbox Code Playgroud)

secondviewclass.m:

#import "secondviewclass.h"
#import "firstviewclass.h"

@implementation secondviewclass
@synthesize labelthatrecivesthetextfieldvalue;


-(void)viewDidLoad{
    [super viewDidLoad];

    firstviewclass *object = [[firstviewclass alloc] init];

    NSString *string = [[NSString alloc] initWithFormat:@"%i", [object.setNumber.text intValue]];

    labelthatrecivesthetextfieldvalue = string; //here is where that error appears "incompatible pointer types assigning to 'UILabel *__weak' to 'NSString *__strong'"

} …
Run Code Online (Sandbox Code Playgroud)

string iphone xcode objective-c ios

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

无法将NSDictionary添加到NSArray

我正在尝试向数组添加字典以在字典上创建数组,但是当我测试应用程序时,数组仍然是空的.看看我的代码:

NSMutableArray *listaEstabelecimentosPorCategoria;


    for (NSDictionary *tempDict in listaEstabelecimentos) {

        if ([[tempDict objectForKey:@"category"] integerValue] == 1) {
            [listaEstabelecimentosPorCategoria addObject:tempDict];

            NSLog(@"TEST");
        }
    }

    NSLog(@"%@", listaEstabelecimentosPorCategoria);
Run Code Online (Sandbox Code Playgroud)

该应用程序打印此:

2013-08-18 12:16:38.802 Petro?polis[10157:c07] TEST
2013-08-18 12:16:38.802 Petro?polis[10157:c07] TEST
2013-08-18 12:16:38.803 Petro?polis[10157:c07] (null)
Run Code Online (Sandbox Code Playgroud)

arrays cocoa-touch objective-c ios

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

奇怪的错误'无法识别的选择器发送到实例'

我试图将一堆变量从一个类传递到另一个类时遇到错误,我的第一个类控制一个视图,而我的另一个类是一个控制表视图的tableviewcontroller,我有一个名为"shoplistSegue"的segue,当我单击一个按钮执行segue并使用"prepareForSegue"方法传递变量.但当我点击按钮时,它会冻结并出现错误"无法识别的选择器发送到实例0x74af950".

class1.h

@interface CalcularViewController : UIViewController{

    int calcularIntHomens;
    int calcularIntMulheres;
    int calcularIntCriancas;

}
@property (strong, nonatomic) IBOutlet UILabel *calcularLabelHomens;
@property (strong, nonatomic) IBOutlet UILabel *calcularLabelMulheres;
@property (strong, nonatomic) IBOutlet UILabel *calcularLabelCriancas;
@property (strong, nonatomic) IBOutlet UILabel *calcularLabelFantasmas;
@property int calcularIntHomens;
@property int calcularIntMulheres;
@property int calcularIntCriancas;
- (IBAction)subtractHomens:(id)sender;
- (IBAction)subtractMulheres:(id)sender;
- (IBAction)subtractCriancas:(id)sender;
- (IBAction)addHomens:(id)sender;
- (IBAction)addMulheres:(id)sender;
- (IBAction)addCriancas:(id)sender;
- (IBAction)showResultsIfNotNull:(id)sender;

@end
Run Code Online (Sandbox Code Playgroud)

class1.m

#import "CalcularViewController.h"
#import "ResultadoViewController.h"

@interface CalcularViewController ()

@end

@implementation CalcularViewController
@synthesize calcularIntCriancas, calcularIntHomens, calcularIntMulheres, calcularLabelCriancas, calcularLabelHomens, calcularLabelMulheres, calcularLabelFantasmas; …
Run Code Online (Sandbox Code Playgroud)

iphone xcode cocoa-touch objective-c ios

0
推荐指数
1
解决办法
687
查看次数

iPhone 4"模拟器开放3.5"应用程序

我的应用程序使用了Storyboard,在故事板上它看起来很好用4英寸大屏幕.但是,在模拟器上打开3.5英寸应用程序并在屏幕上方放置一些黑色空间.

故事板: 在此输入图像描述

模拟器: 在此输入图像描述

cocoa-touch ios ios-simulator iphone-5

0
推荐指数
1
解决办法
181
查看次数

stringByReplacingOccurrencesOfString:不起作用

我希望我的输出为"23",但它仍显示"123".

NSString *valorTextField = [[NSString alloc] initWithFormat:@"123"];
    [valorTextField stringByReplacingOccurrencesOfString:@"1" withString:@""];
    NSLog(@"%@", valorTextField);
Run Code Online (Sandbox Code Playgroud)

nsstring ios

0
推荐指数
2
解决办法
3131
查看次数

如何在用户编辑时获取UITextView文本

我用
[self.assuntoTextField addTarget:self action:@selector(testarSeTemTexto) forControlEvents:UIControlEventEditingChanged];

得到的文本值UITextFields,但我不能这样做UITextViews,我怎么能这样做用户仍在编辑TextView?

objective-c uitextfield uitextview ios

0
推荐指数
1
解决办法
1039
查看次数

如何获得中间字符串字符?

我有一个日期字符串,就像这样@"dd/mm/yyyy",我希望将这个字符串分成3个小字符串,包括日,月和年.我使用这段代码成功完成了这一天:

self.dayLabel.text = [string substringToIndex:2];
Run Code Online (Sandbox Code Playgroud)

但是如何获得中间值,比如月份?

objective-c nsstring ios

0
推荐指数
1
解决办法
1069
查看次数

如何在通过GET发送信息之前加密Md5文本输入?

我有一个小的登录表单,我将通过GET发送名称和密码,但我不想将密码放在纯文本的URL中.按下提交按钮之后,但是在通过GET发送之前,我可以Md5吗?

php forms md5 get

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