UA-17470720-3

Jump to content


Photo
- - - - -

Image picker - the same photo


  • Please log in to reply
7 replies to this topic

#1 former

former

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 14 posts
Reputation: 5
Good

Posted 08 January 2015 - 12:09 PM

I will make a very simple app, when the user can take a photo,with the camera in the app.

But its always use the last photo on all the table cell. The user can not have different photo. Its always the same photo (last taken photo).

 

Attached File  Sk√¶rmbillede 2015-01-08 kl. 20.43.06.png   116.69K   11 downloads

 

Attached File  IMG_1464.PNG   72.79K   19 downloadsAttached File  IMG_1465.PNG   71.98K   16 downloads

 

 

Should I do something specific to the stores different photo?

 

Jens Andersen


Edited by former, 08 January 2015 - 12:09 PM.


#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 08 January 2015 - 12:34 PM

Hi Jens,

 

You can have a "Clear" button appear in the detail view by setting the cell's displayClearImageButtonInDetailView to YES. For more information, please refer to SCImagePickerCell documentation (Overview section).



#3 former

former

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 14 posts
Reputation: 5
Good

Posted 08 January 2015 - 01:16 PM

Thanks

 

But the problem is

Step1

I make a new task. Take a photo (with the camera) on the image picker button. and save the the task.

Step2

I make a new task, take a new photo. And the newest photo i have taken, overwrite the first photo i have taken in the  step 1. 

 

I will not have the app to overwrite the first photo, I will keep both photo, on the tasks

 

Jens


Edited by former, 08 January 2015 - 01:19 PM.


#4 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 19 January 2015 - 08:48 AM

Hi Jens,

 

I am having trouble replicating this. Are you able to provide a stripped down sample? Thanks.



#5 former

former

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 14 posts
Reputation: 5
Good

Posted 22 January 2015 - 12:30 PM

Hi

 

Its so embarrassing, and my mistake. I still have much to learn :-D

 

Its now so easy with the new interface (storyboard) Nice :-D, so i just choose Image Picker, and not wrote any code. And the the Image picker not have any idea to save and load the picture :-D

 

But I will be very happy, if you can show me, how I can begin with the code. 

 

 

 

Attached Files



#6 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 29 January 2015 - 07:18 AM

Hi Jens,

 

I apologize for the delayed reply since we're getting behind schedule with our next release that many are waiting for.

 

I checked your app, and the 'taskDef' you're working with in MasterViewController.m is not the same 'taskDef' that you defined in your Storyboard, and hence any actions you set never get called. You shouldn't be declaring a new taskDef, but rather accessing the one you already created in IB using the following:

 

SCEntityDefinition *taskDef = (SCEntityDefinition *)[self dataDefinitionWithIBName:@"TaskEntity"];

 

Also, please note that you don't need to define the action on two stages as you did in the project (first you did willConfigure then saveImage). All you need is simply this:

 

imagePropertyDef.cellActions.saveImage = ^(SCImagePickerCell *imagePickerCell, NSIndexPath *indexPath, NSString *imagePath)
    {
        UIImage *myImage = imagePickerCell.selectedImage;
        NSManagedObject *myCoreDataObject = (NSManagedObject *)imagePickerCell.boundObject;
        
        // Convert the myImage to binary here then write it in myCoreDataObject
    };

 

Same thing for loadImage. Hope this helps.



#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 29 January 2015 - 07:21 AM

One more thing: there is a bug that has been already reported where 'myImage' in the above code is sometimes 'nil'. This bug should be fixed in our upcoming release. Thanks!



#8 former

former

    Jr. Member

  • STV 5.0 Std
  • PipPip
  • 14 posts
Reputation: 5
Good

Posted 31 January 2015 - 08:19 AM

Hi

 

Thanks its works now.

 

 

Keep the good work :-D






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users