我ImageView在Android项目中使用了一个.
宽度:match_parent
高度:wrap_content
我将它缩放到了fill_XY,但图像还不是正方形......我该怎么办?

我有一个视图,用户在这个视图中,没有办法消失.有一个广告,比一段时间后出现"go"按钮,或更好,它会自动进入下一个视图!我正在使用故事板.
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?
我一直在使用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) 我正在尝试向数组添加字典以在字典上创建数组,但是当我测试应用程序时,数组仍然是空的.看看我的代码:
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) 我试图将一堆变量从一个类传递到另一个类时遇到错误,我的第一个类控制一个视图,而我的另一个类是一个控制表视图的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) 我的应用程序使用了Storyboard,在故事板上它看起来很好用4英寸大屏幕.但是,在模拟器上打开3.5英寸应用程序并在屏幕上方放置一些黑色空间.
故事板: 
模拟器: 
我希望我的输出为"23",但它仍显示"123".
NSString *valorTextField = [[NSString alloc] initWithFormat:@"123"];
[valorTextField stringByReplacingOccurrencesOfString:@"1" withString:@""];
NSLog(@"%@", valorTextField);
Run Code Online (Sandbox Code Playgroud) 我用
[self.assuntoTextField addTarget:self action:@selector(testarSeTemTexto) forControlEvents:UIControlEventEditingChanged];
得到的文本值UITextFields,但我不能这样做UITextViews,我怎么能这样做用户仍在编辑TextView?
我有一个日期字符串,就像这样@"dd/mm/yyyy",我希望将这个字符串分成3个小字符串,包括日,月和年.我使用这段代码成功完成了这一天:
self.dayLabel.text = [string substringToIndex:2];
Run Code Online (Sandbox Code Playgroud)
但是如何获得中间值,比如月份?
我有一个小的登录表单,我将通过GET发送名称和密码,但我不想将密码放在纯文本的URL中.按下提交按钮之后,但是在通过GET发送之前,我可以Md5吗?
ios ×9
objective-c ×6
cocoa-touch ×5
iphone ×2
nsstring ×2
xcode ×2
android ×1
arrays ×1
forms ×1
get ×1
imageview ×1
iphone-5 ×1
md5 ×1
php ×1
string ×1
uistoryboard ×1
uitextfield ×1
uitextview ×1