我试图在iOS中检查带有正则表达式的文本,这是我的代码.我的正则表达式接受一个单词或数字,它应该是最小值8和最大值16,用数字或字母表示.
if (![self validate:txtPass.text regex:@"^[a-zA-Z0-9]+$"]){
NSLOG(@"Check value");
}
Run Code Online (Sandbox Code Playgroud)
我的正则表达式应该改变什么?
我创建了一个自定义单元格FeatureCell,它在行中有5个图像将在主视图中调用,但是当我调用它时,我得到空行.那么请问哪里可能是我的问题?
我已经搜索了自定义单元格,我使用了我在下面的代码中使用的方式但没有任何反应.
这是我的FeatureCell.h
@interface FeatureCell : UITableViewCell{
IBOutlet UIImageView *img1;
IBOutlet UIImageView *img2;
}
@property (nonatomic, retain) UIImageView *img1;
@property (nonatomic, retain) UIImageView *img2;
@end
Run Code Online (Sandbox Code Playgroud)
这是我的FeatureCell.m
@implementation FeatureCell
@synthesize img,img1,img2,img3,img4;
@end
Run Code Online (Sandbox Code Playgroud)
这是我的视图控制器.m
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section == 0) {
return [objectCollection count];
}
else{
return 1;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* cellIdentifier1 = @"FeatureCell";
FeatureCell *cell1 = (FeatureCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier1];
if (cell1 == nil)
{
NSArray …
Run Code Online (Sandbox Code Playgroud) 我试图根据'Locale'大写所有字符串,但它不起作用.
var text = "istanbul, izmir"
println(text.uppercaseStringWithLocale(NSLocale.currentLocale()))
Run Code Online (Sandbox Code Playgroud)
在土耳其语中,我的大写是不是我.我的结果是伊斯坦布尔,IZMIR但它应该返回İSTANBUL,İZMİR.
请问我的问题在哪里?
我正在从服务器加载数据,但我有一个问题,我返回的值是零(0),而我不能进去,如果.请问哪里会有问题?
-(void)method1
{
NSNumber *value = [data objectForKey:@"samount"];
NSLog(@"number is -%@-", value); //number is -0-
if (value == 0)
{
NSLog(@" OK :) ");
}
else
{
NSLog(@" Bad :( ");
}
}
Run Code Online (Sandbox Code Playgroud) ios ×4
iphone ×2
custom-cell ×1
gps ×1
nslocale ×1
nsnumber ×1
objective-c ×1
regex ×1
swift ×1
uitableview ×1
xcode ×1