我有两个UIViewController类,在FirstClass我有一个UIButton用于登录,当用户点击按钮时,我将显示SecondClass...为此我做了,
SecondClass *index = [[SecondClass alloc] init];
[self presentModalViewController:index animated:YES];
Run Code Online (Sandbox Code Playgroud)
在SecondClass中,我有一个注销按钮,它会重定向到FirstClass,因为我已经完成了,
[self dismissModalViewControllerAnimated:YES];
Run Code Online (Sandbox Code Playgroud)
当我按下SecondClass中的Logout按钮时,我收到警告信息
**Attempt to dismiss from view controller <FirstClass: 0e39w88e160> while a presentation or dismiss is in progress!**
Run Code Online (Sandbox Code Playgroud)
这里有什么问题..
我有两个controllers第一个self和第二个maincontroller,我maincontroller在堆栈中,所以后退按钮自动进入.
在这里,我需要在用户按下后退按钮时发出警报.
我怎样才能做到这一点?
我必须在我的应用程序中显示日期,我需要以格式显示12 - hour format,我已经使用此代码显示date
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:kDateDisplayFormat];
NSTimeZone *timeZone = [NSTimeZone systemTimeZone];
[dateFormatter setTimeZone:timeZone];
NSString *todaysDate = [NSString stringWithFormat:@"%@",[dateFormatter stringFromDate:[NSDate date]]];
[[self lblPointsDate] setText:todaysDate];
Run Code Online (Sandbox Code Playgroud)
在这里,当我将我的iPhone日期格式更改为24小时时,它以24小时格式显示.我需要将 24小时转换为12小时格式或仅以12小时格式显示.我怎样才能做到这一点?
我在ViewdidLoad中声明了NSString的一些字符串值,比如..
int i=1;
strval=[NSString stringWithFormat:@"%03d",i];
strval=[NSString stringWithFormat:@"S%@",strval];
NSLog(@"Value %@",strval);
Run Code Online (Sandbox Code Playgroud)
它给出了正确的结果作为S001,但当我在IBAction中打印时,如,
- (IBAction)stringvalue:(id)sender {
NSLog(@"Value %@",strval);
}
Run Code Online (Sandbox Code Playgroud)
它每次都会给出未知值.有时会抛出EXEC_BAD_ACCESS错误.
请帮我..
我开发了我的应用程序并创建了ipa file.我已经添加了设备ID列表,我下载了证书.现在我想将.ipa文件发送给客户..ipa单独发送文件是否足够?或者我是否必须发送下载的证书?
多个UIImageView上的TapGesture识别器无法正常工作,同时它检测到最后添加的图像视图手势..我已经这样做了,
UITapGestureRecognizer *tapped = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(myFunction:)];
tapped.numberOfTapsRequired = 1;
tapped.delegate = self;
UIImageView *sample_book1= [[UIImageView alloc]initWithFrame:CGRectMake(70, 135, 100,125) ];
sample_book1.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"mathematics.png"]];
sample_book1.userInteractionEnabled = YES;
sample_book1.tag = 0;
[sample_book1 addGestureRecognizer:tapped];
[self.view addSubview:sample_book1];
UIImageView *sample_book2= [[UIImageView alloc]initWithFrame:CGRectMake(220, 135, 100,125) ];
sample_book2.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"biology.png"]];
sample_book2.userInteractionEnabled = YES;
sample_book2.tag = 1;
[sample_book2 addGestureRecognizer:tapped];
[self.view addSubview:sample_book2];
UIImageView *sample_book3= [[UIImageView alloc]initWithFrame:CGRectMake(370, 135, 100,125) ];
sample_book3.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"chemistry.png"]];
sample_book3.userInteractionEnabled = YES;
sample_book3.tag = 2;
[sample_book3 addGestureRecognizer:tapped];
[self.view addSubview:sample_book3]; …Run Code Online (Sandbox Code Playgroud) 我有一个ViewController类,其中我有一个名为templateViewself.view 的UIView ,它由一个名为UIView的UIView组成gridView,这里我需要刷卡templateView,因为我已经添加了swipegesture,
swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeRightAction)];
swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeLeftAction)];
swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
swipeRight.delegate = self;
swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
swipeLeft.delegate = self;
[templateView addGestureRecognizer:swipeRight];
[templateView addGestureRecognizer:swipeLeft];
Run Code Online (Sandbox Code Playgroud)
在swipeRight和swipeLeft我需要移动gridView左侧和右侧..我需要在这些方法中实现..?
我有一个UITextField我需要更改Placeholder字体和颜色的地方,我在drawRect方法中调用下面的方法,
-(void) setFontColorForPlaceHolder
{
for(id obj in [[self baseScrollView] subviews])
{
if([obj isKindOfClass:[UITextField class]])
{
[obj setAttributedPlaceholder:[[NSAttributedString alloc]initWithString:[obj placeholder] attributes:@{
NSFontAttributeName:kFutura_Medium_14 ,NSForegroundColorAttributeName:[UIColor redColor]
}]];
}
}
}
Run Code Online (Sandbox Code Playgroud)
这里的颜色正在变化但是FONT没有设置.这是什么问题setAttributedPlaceholder.
我有一个像@"1234123412341234"的字符串,我需要在每4个字符之间追加空格.
@"1234 1234 1234 1234"
Run Code Online (Sandbox Code Playgroud)
也就是说,我需要NSString像Visa卡类型.我试过这样但我没有得到我的结果.
-(void)resetCardNumberAsVisa:(NSString*)aNumber
{
NSMutableString *s = [aNumber mutableCopy];
for(int p=0; p<[s length]; p++)
{
if(p%4==0)
{
[s insertString:@" " atIndex:p];
}
}
NSLog(@"%@",s);
}
Run Code Online (Sandbox Code Playgroud) 我已经从服务器加载了一个HTML文件并显示在该文件中UIWebview,其中包含OnClick该文件中的一个函数,当用户OnClicks时,我将获得一个视频URL.我想在iOS中 打开该视频网址videoplayer.我怎样才能做到这一点?请帮我.
ios ×9
objective-c ×8
iphone ×4
xcode ×2
ipa ×1
nsdate ×1
nsstring ×1
uiimageview ×1
uitextfield ×1
uiview ×1