小编Baz*_*nga的帖子

iCarousel停在用户选择的索引上

编辑:

我正在制作一个类似老虎机的应用程序,我iCarousel为插槽对象添加了.所以我有一个旋转的按钮iCarousel.在我的iCarousel视图中有两个插槽(Slot1和Slot2).以下是我iCarouselView:(方框是TWO所在的carousel位置)

在此输入图像描述

这是我旋转我的方式iCarousel:

-(IBAction) spin {

[carousel1 scrollByNumberOfItems:-35 duration:10.7550f];
[carousel2 scrollByNumberOfItems:-35 duration:10.7550f];

}
Run Code Online (Sandbox Code Playgroud)

这就是我想做的事情:我想强行让它停在用户选择的索引上.

我这样做了,下面的图片中newViewcontroller包含UIImageView一个按钮,所以当用户点击它时,我会CustomPicker弹出.我CustomPicker包含用户在相机胶卷上拾取的图像.所以每个按钮都有一个发送给我的特定值 iCarouselView.slot1的carousel1和slot2的carousel2.

所以我的问题是旋转旋转木马然后在特定时间使其停止到用户选择的所需图像/索引.

对不起,我的英语不好. 在此输入图像描述

iphone xcode ios

10
推荐指数
1
解决办法
2138
查看次数

在NSDocumentDirectory中保存好吗?

我的应用程序正在使用它NSDocumentDirectory来保存图像,我只想询问它是否是保存图像的安全方式(最多100个).我已经阅读了几个关于它的问题的线索和问题,虽然我不知道该跟哪个.有人说可以保存在那里.有人说我不应该NSDocumentDirectory用来储蓄,因为它会被备用iCloud.那么我在哪里可以保存它,当用户退出应用程序然后再次运行应用程序,然后图像应该仍在那里?我不太了解tmp目录或cache目录.但如果它是我应该使用的2个中的任何一个,我如何在我的代码中使用它们:

                NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,    NSUserDomainMask ,YES );
                NSString *documentsDir = [paths objectAtIndex:0];
                NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"Images%d.png", i]];
                ALAssetRepresentation *rep = [[info objectAtIndex: i] defaultRepresentation];
                UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]];
                //----resize the images
                image = [self imageByScalingAndCroppingForSize:image toSize:CGSizeMake(256,256*image.size.height/image.size.width)];

                NSData *imageData = UIImagePNGRepresentation(image);
                [imageData writeToFile:savedImagePath atomically:YES];
Run Code Online (Sandbox Code Playgroud)

非常感谢你的帮助.

iphone xcode ios

6
推荐指数
1
解决办法
7264
查看次数

动态settings.py

我使用django-constance作为库.虽然我注意到的一件事是当我尝试使用ADMIN和时MANAGER

CONSTANCE_CONFIG = {
'ADMINS': ([('Errors', 'admin@gmail.com')], 'Admin Emails'),
}
Run Code Online (Sandbox Code Playgroud)

发送电子邮件不起作用.

在MANAGER中我试过这个:

MANAGER = CONSTANCE_CONFIG['ADMINS'][0]
Run Code Online (Sandbox Code Playgroud)

仍然发送电子邮件不起作用.我错过了错误的实现吗?或者你可以建议任何其他可以覆盖ADMINMANAGER进入的库settings.py.我正在使用Django 1.8.5和Python 3.

当尝试导入settings.py内部时,它也会产生错误.

python django

6
推荐指数
1
解决办法
1080
查看次数

像核心动画老虎机一样在z轴上旋转

我可以通过此代码在此处移动或动画我的UIView:

- (void) makeAnim1{

    //downward animation 
    [UIView animateWithDuration:1.5
                          delay:0.15
                        options: UIViewAnimationCurveLinear
                     animations:^{
                         carousel.frame = CGRectOffset(carousel.frame, 0, 650);
                     }
                     completion:^(BOOL finished){ //task after an animation ends
                         [self performSelector:@selector(makeAnim1_1) withObject:nil afterDelay:2.0];
                         NSLog(@"Done!");
                     }];    
}

- (void) makeAnim1_1{

    //upward animation
    [UIView animateWithDuration:1.5
                          delay:0.1
                        options: UIViewAnimationCurveLinear
                     animations:^{
                         carousel.frame = CGRectOffset(carousel.frame, 0, -650);
                     } 
                     completion:^(BOOL finished){
                        NSLog(@"Done!");
                     }];    


} 
Run Code Online (Sandbox Code Playgroud)

但它只是上下移动UIView.如何让它像一个旋转,Slot machine但只包含一个图像或视图.像在z轴上旋转一样.但要让它看起来像包含多个图像.

谢谢您的帮助.

iphone xcode core-animation ios

5
推荐指数
1
解决办法
2343
查看次数

uibutton发件人标签

我有一个UIImageView对象,单击它时会播放动画,我想重用相同的代码来制作多个对象.如何设置发件人标签以使其知道其不同的对象?

.H

- (IBAction)startClick:(id)sender;
Run Code Online (Sandbox Code Playgroud)

.M

- (IBAction)startClick:(id)sender
{
    //UIImageView *theButton = (UIImageView *)sender.tag;

    bubble.animationImages = [NSArray arrayWithObjects:
                           [UIImage imageNamed: @"Pop_1.png"],
                           [UIImage imageNamed: @"Pop_2.png"],
                           [UIImage imageNamed: @"Pop_3.png"], nil];

    [bubble setAnimationRepeatCount:1];
    bubble.animationDuration = 1;
    [bubble startAnimating];
}
Run Code Online (Sandbox Code Playgroud)

iphone xcode

4
推荐指数
1
解决办法
2万
查看次数

重复自我执行选择器

我只是在徘徊如果有一种更简单的方法来重复下面的代码20秒.如果有,怎么样?

[self performSelector:@selector( move1) withObject:nil afterDelay:0.0];
[self performSelector:@selector( move2) withObject:nil afterDelay:0.2];
[self performSelector:@selector( move3) withObject:nil afterDelay:0.4];
[self performSelector:@selector( move1) withObject:nil afterDelay:0.8];
[self performSelector:@selector( move2) withObject:nil afterDelay:0.10];
[self performSelector:@selector( move3) withObject:nil afterDelay:0.12];
Run Code Online (Sandbox Code Playgroud)

iphone xcode ios

4
推荐指数
2
解决办法
5301
查看次数

UIScrollView错误地更新/加载

我正在预览我的ViewController所有Picked图像imagePicker将在我的scrollView中,是的,我能够预览它thumbnail,但是当我在调试器中记录它时,似乎每次我的viewDidAppear,它也reAddsscrollView,因此图像计数被再次添加,使其难以在视图中删除由于图像的overlaping.我需要的是scrollview只要在视图出现时和我添加新图像时刷新.

以下是我长期遇到问题的代码的预览:

- (id) initWithCoder:(NSCoder *)aDecoder {
    if ((self = [super initWithCoder:aDecoder])) {
        _images =  [[NSMutableArray alloc] init];
        _thumbs =  [[NSMutableArray alloc] init];
    }
    return self;
}
- (void)addImage:(UIImage *)image {
    [_images addObject:image];
    [_thumbs addObject:[image imageByScalingAndCroppingForSize:CGSizeMake(60, 60)]];
    [self createScrollView];
}        
- (void) createScrollView {

    [scrollView setNeedsDisplay];
    int row = 0;
    int column = 0;
    for(int i = 0; i < _thumbs.count; ++i) {

        UIImage *thumb = …
Run Code Online (Sandbox Code Playgroud)

iphone xcode ios

3
推荐指数
1
解决办法
515
查看次数

以错误的方向保存图像

我正在使用AGImagepickerContoller可以保存相机胶卷中的多张图像,我将这种方式保存在successBlock:

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory,    NSUserDomainMask ,YES );
    NSString *documentsDir = [paths objectAtIndex:0];
    NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"oneSlotImages%u.png", i]];

    ALAssetRepresentation *rep = [[info objectAtIndex: i] defaultRepresentation];
    UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]];

    //----resize the images
    image = [self imageByScalingAndCroppingForSize:image toSize:CGSizeMake(256,256*image.size.height/image.size.width)];

    NSData *imageData = UIImagePNGRepresentation(image);
    [imageData writeToFile:savedImagePath atomically:YES];
Run Code Online (Sandbox Code Playgroud)

我的问题是保存时,并在我的预览中加载.它看起来像这样: 在此输入图像描述

我想要的是在预览中这样:

在此输入图像描述

上传后我已经读过这个iOS UIImagePickerController结果图像方向.

但我不太明白我应该把它放在我的代码中.希望有人可以指导我的问题.谢谢.

iphone xcode ios

3
推荐指数
1
解决办法
5556
查看次数

在NSDocumentDirectory中删除

我以NSDocumentDirectory这种方式保存:

NSLog(@"%@", [info objectAtIndex:i]);
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory,    NSUserDomainMask ,YES );
NSString *documentsDir = [paths objectAtIndex:0];
NSString *savedImagePath = [documentsDir stringByAppendingPathComponent:[NSString stringWithFormat:@"Images%d.png", i]];

ALAssetRepresentation *rep = [[info objectAtIndex: i] defaultRepresentation];
UIImage *image = [UIImage imageWithCGImage:[rep fullResolutionImage]];

//----resize the images
image = [self imageByScalingAndCroppingForSize:image toSize:CGSizeMake(256,256*image.size.height/image.size.width)];

NSData *imageData = UIImagePNGRepresentation(image);
[imageData writeToFile:savedImagePath atomically:YES];
Run Code Online (Sandbox Code Playgroud)

我知道如何删除所有图像NSDocumentDirectory.

但我想知道如何删除名称为的所有图像oneSlotImages.

谢谢

iphone xcode ipad ios

2
推荐指数
1
解决办法
3044
查看次数

按钮圆角上的UIImage

可能重复:
如何在iphone中的UI图像中设置圆角

基本上,这是我添加我的图像预览的方式UIScrollView,我添加我的按钮然后添加我的图像,但是我怎样才能使我的图像成为圆角并按下按钮形状.因为在我的预览中它看起来像这样.

在此输入图像描述

- (void)addImage:(UIImage *)imageToAdd {
    [_images addObject:imageToAdd];
    [_thumbs addObject:[imageToAdd imageByScalingAndCroppingForSize:CGSizeMake(50, 50)]];

    int row = floor(([_thumbs count] - 1) / 5);
    int column = (([_thumbs count] - 1) - (row * 5));

    UIImage *thumb = [_thumbs objectAtIndex:[_thumbs count]-1];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.frame = CGRectMake(column*60+10, row*60+10, 55, 55);
    [button setImage:thumb forState:UIControlStateNormal];
    [button addTarget:self action:@selector(deleteItem:) forControlEvents:UIControlEventTouchUpInside];
    button.tag = [_images count] - 1;
    // This is the title of where they were created, so we can see them …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c ios

2
推荐指数
1
解决办法
254
查看次数

标签 统计

iphone ×9

ios ×8

xcode ×8

core-animation ×1

django ×1

ipad ×1

objective-c ×1

python ×1