我试图从图像选择器中选择一个图像后创建一个模态视图控制器.我用的代码是:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSLog(@"Picker has returned");
[self dismissModalViewControllerAnimated:YES];
// TODO: make this all threaded?
// crop the image to the bounds provided
img = [info objectForKey:UIImagePickerControllerOriginalImage];
NSLog(@"orig image size: %@", [[NSValue valueWithCGSize:img.size] description]);
// save the image, only if it's a newly taken image:
if([picker sourceType] == UIImagePickerControllerSourceTypeCamera){
UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil);
}
// self.image_View.image=img;
//self.image_View.contentMode = UIViewContentModeScaleAspectFit;
ModalViewController *sampleView = [[ModalViewController alloc] init];
[self presentModalViewController:sampleView animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
但是,我收到警告:
Warning: Attempt to present <ModalViewController: 0x7561600> on …Run Code Online (Sandbox Code Playgroud) 从屏幕上删除等待视图时,我的应用程序崩溃了一段时间.请指导我如何改进下面给出的代码.
仅当应用程序从服务器下载内容时才会调用等待视图.当它完成下载后,我调用removeWaitView方法.
异常类型:NSGenericException
原因: 收集在枚举时发生了变异.
+(void) removeWaitView:(UIView *) view{
NSLog(@"Shared->removeWaitView:");
UIView *temp=nil;
temp=[view viewWithTag:kWaitViewTag];
if (temp!=nil) {
[temp removeFromSuperview];
}
}
Run Code Online (Sandbox Code Playgroud)
我的waitview添加代码是
+(void) showWaitViewInView:(UIView *)view withText:(NSString *)text{
NSLog(@"Shared->showWaitViewWithtag");
UIView *temp=nil;
temp=[view viewWithTag:kWaitViewTag];
if (temp!=nil)
{
return;
}
//width 110 height 40
WaitViewByIqbal *waitView=[[WaitViewByIqbal alloc] initWithFrame:CGRectMake(0,0,90,35)];
waitView.center=CGPointMake(view.frame.size.width/2,(view.frame.size. height/2) -15);
waitView.tag=kWaitViewTag; // waitView.waitLabel.text=text;
[view addSubview:waitView];
[waitView release];
}
Run Code Online (Sandbox Code Playgroud) 我正在创建一个具有照片共享的应用程序,我正在尝试添加提及(或标记)用户的功能.Twitter最初开始使用"@",用户名来标记用户,但现在从Facebook到Instagram的所有内容都在使用它.这是在iOS端还是在后端实现的东西?我目前在Django编程后端,但由于某种原因,我认为这将在iOS端完成.令人惊讶的是,关于如何在Django或iOS中提及用户的信息非常少.
基本上,在创建帖子时,我想创建一个用户提及,输入"@"后跟一个用户名(之间没有空格),这将在帖子中显示他们的名字,如下所示:@username,可点击,领先回到该用户的个人资料.如果我对我的问题有任何疑问,请告诉我.任何帮助,例如指向我从哪里开始的正确方向,将非常感激.谢谢!:)
我正在尝试制作一个动画,其中文本在淡出时移动到底部,同时它再次出现在与之前相同的位置并执行相同的动画.我的代码:
for (int i=0; i<10; i++)
{
[UIView animateWithDuration:0.5
delay:0.2f
options:UIViewAnimationCurveEaseInOut
animations:^{
productTextLabel.center = CGPointMake(381, 410);
productTextLabel.alpha = 0.0;
productTextLabel.center = CGPointMake(381, 340);
productTextLabel.alpha = 1;
}
completion:^(BOOL fin) {
}];
}
Run Code Online (Sandbox Code Playgroud)
我的问题是我试图使这个动画发生不止一次.我正在使用for循环,但它只执行一次.