我的应用程序正在放置一个带有自定义背景图像的按钮,我不需要它周围的边框.我不知道如何删除边框.我的代码是:
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame=CGRectMake(100, 170, 100,30);
UIImage *cbutton = [UIImage imageNamed:@"pdficon_small.png"];
[button setImage:cbutton forState:UIControlStateNormal];
UIButton *button2 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button2 addTarget:self
action:@selector(openWordings:)
forControlEvents:UIControlEventTouchDown];
[button setTag:2];
[self.view addSubview:button];
Run Code Online (Sandbox Code Playgroud)
提前致谢.
当用户单击textField时,我正在使用带有弹出窗口的DatePicker.但是,Picker首先显示Month,而不是首先显示日期,并且不是英国人写日期的方式.有没有办法将DatePicker中的日期格式设置为英国方式,如dd/mm/yyyy?我正在使用Achtionsheet:
-(IBAction)acsheet:(id)sender
{
actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
//CGRect pickerFrame = CGRectMake(0, 45, 0, 0);
pickerView1 = [[UIDatePicker alloc] init];
pickerView1.datePickerMode = UIDatePickerModeDate;
[actionSheet addSubview:pickerView1];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Close"]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet:)
forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:closeButton];
[actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];
[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];
[pickerView1 addTarget:self
action:@selector(updateLabel:)
forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil …Run Code Online (Sandbox Code Playgroud) 我的应用程序是一个JSON代码,涉及字符串类型的日期.(如"2011-10-01").我想知道如何将其转换为NSDate?它需要以不同的时间格式显示,例如"2011年10月1日".
恩.此代码不起作用:
NSString *date1 = @"2010-11-12";
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"yyyy-MMMM-dd"];
NSDate *date2 = [dateFormat dateFromString:date1];
NSString *strdate = [dateFormat stringFromDate:date2];
Run Code Online (Sandbox Code Playgroud) 我正在放置UITextfield和UISwitch实例UITableView.我可检测标记和值,但不知道如何检测它们是否UISwitch还是UITextField?
我打算为每个人设置不同的行动.
我正在使用此代码来显示datePicker.单击textField时,会出现.但是,"关闭"按钮会覆盖DatePicker.你知道有什么方法可以将它降低一点吗?提前致谢.
-(IBAction)acsheet:(id)sender{
actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:nil
cancelButtonTitle:nil
destructiveButtonTitle:nil
otherButtonTitles:nil];
[actionSheet setActionSheetStyle:UIActionSheetStyleBlackTranslucent];
//CGRect pickerFrame = CGRectMake(0, 45, 0, 0);
pickerView1 = [[UIDatePicker alloc] init];
pickerView1.datePickerMode = UIDatePickerModeDate;
[actionSheet addSubview:pickerView1];
UISegmentedControl *closeButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@"Close"]];
closeButton.momentary = YES;
closeButton.frame = CGRectMake(260, 7.0f, 50.0f, 30.0f);
closeButton.segmentedControlStyle = UISegmentedControlStyleBar;
closeButton.tintColor = [UIColor blackColor];
[closeButton addTarget:self action:@selector(dismissActionSheet:) forControlEvents:UIControlEventValueChanged];
[actionSheet addSubview:closeButton];
[actionSheet showInView:[[UIApplication sharedApplication] keyWindow]];
[actionSheet setBounds:CGRectMake(0, 0, 320, 485)];
[pickerView1 addTarget:self
action:@selector(updateLabel:)
forControlEvents:UIControlEventValueChanged];
UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; …Run Code Online (Sandbox Code Playgroud) 我正在使用xcode4和storyboard来创建一个申请表.我想添加检查按钮,发现使用NSButton是最好的方法,但我在对象库中找不到NSButton.你能告诉我怎么找到它吗?
我想在数组中的所有嵌套数组中找到重复值.目前我的阵列是这样的.
Array $bigarray = Array (
[431] => Array (
[0] => orange
[1] => apple
[2] => pine
)
[440] => Array (
[0] => orange
[1] => lilly
)
[444] => Array (
[0] => orange
[1] => pine
)
)
Run Code Online (Sandbox Code Playgroud)
我想只提取orange哪一个
arrays('431','440','444').
Run Code Online (Sandbox Code Playgroud)
Woudl你给我一些想法......?提前致谢.
ios ×5
iphone ×5
objective-c ×5
datepicker ×2
ios5 ×2
xcode ×2
button ×1
cocoa-touch ×1
date ×1
nsbutton ×1
php ×1
xcode4 ×1