Change a Property for All Objects in an NSMutableArray - objective-c

I have an NSMutableArray with 9 objects. Those objects have many properties, like questionName, questionWhatRow, etc.
I want to be able to change one of those properties for All of the objects in the NSMutableArray.
Here is my NSMutableArray Class.
-(id) init
{
self = [super init];
if (self)
{
self.questionsArray = [[NSMutableArray alloc] init];
Question *newQuestion = [[Question alloc] init];
newQuestion.questionName = #"What is the name of the girl who has to fetch water for her family every day?";
newQuestion.questionRowName = #"Question 1";
newQuestion.questionAnswer = #"Nya";
newQuestion.questionHint = #"Maybe if you read the book you would know";
newQuestion.questionWhatRow = #"Nya";
newQuestion.questionCompleteOrNot = #"No";
newQuestion.pointForQuestion = 1;
[self.questionsArray addObject:newQuestion];
newQuestion = [[Question alloc] init];
newQuestion.questionName = #"What is Nya's sister's name?";
newQuestion.questionRowName = #"Question 2";
newQuestion.questionAnswer = #"Akeer";
newQuestion.questionHint = #"Maybe if you read the book you would know";
newQuestion.questionWhatRow = #"Nya";
newQuestion.questionCompleteOrNot = #"No";
newQuestion.pointForQuestion = 1;
[self.questionsArray addObject:newQuestion];
newQuestion = [[Question alloc] init];
newQuestion.questionName = #"What people is Nya's mother scared of when her father and sons go hunting?";
newQuestion.questionRowName = #"Question 3";
newQuestion.questionAnswer = #"Dinka";
newQuestion.questionHint = #"Maybe if you read the book you would know";
newQuestion.questionWhatRow = #"Nya";
newQuestion.questionCompleteOrNot = #"No";
newQuestion.pointForQuestion = 1;
[self.questionsArray addObject:newQuestion];
newQuestion = [[Question alloc] init];
newQuestion.questionName = #"What is Salva scared of when he is in the Akobo desert?";
newQuestion.questionRowName = #"Question 4";
newQuestion.questionAnswer = #"Lions";
newQuestion.questionHint = #"He is scared of an animal because it ate his friend Marial";
newQuestion = nil;
}
return self;
}
-(NSUInteger)count
{
return questionsArray.count;
}
- (Question *)questionAtIndex:(NSUInteger)index
{
return [questionsArray objectAtIndex:index];
}
Now, I have another class called ScoreViewController, and I want to be able to change the property, questionCompleteOrNot of the NSMutableArray questionsArray for all objects/questions to #"No".
My ScoreView has a button to Reset, but I don't know what to put in it to change all questionCompleteOrNot properties of the questionsArray to #"No".
Sorry for the long question, I was trying to be very specific.
Edit
Here is my DetailView for a tableView.
if ([[selectedQuestion questionCompleteOrNot] isEqualToString:#"No"])
{
if ([[selectedQuestion questionAnswer] caseInsensitiveCompare:answerField.text] == NSOrderedSame)
{
// Show the correct label
[correctLabel setHidden:NO];
correctLabel.text = #"Correct!";
correctLabel.textColor = [UIColor greenColor];
}
else
{
// Show the incorrect label
[correctLabel setHidden:NO];
correctLabel.text = #"Incorrect";
correctLabel.textColor = [UIColor redColor];
[incorrectPlayer play];
[[selectedQuestion questionCompleteOrNot] isEqualToString:#"Yes"];
}
// Erase the text in the answerField
answerField.text = #"";
}
if ([[selectedQuestion questionCompleteOrNot] isEqualToString:#"Yes"])
{
UIAlertView *error = [[UIAlertView alloc]
initWithTitle:#"Error"
message:#"You already answered this question. Please click the reset button on the score view to restart."
delegate:self
cancelButtonTitle:#"Okay!"
otherButtonTitles:nil];
[error show];
answerField.text = #"";
}
selectedQuestion.questionCompleteOrNot = #"Yes";
correctLabel.text = #"";
NSLog(#"Selected question's questionCompleteOrNot is %#", [selectedQuestion questionCompleteOrNot]);

You can use NSArray's makeObjectsPerformSelector:withObject:, like so:
[questionsArray makeObjectsPerformSelector:#selector(setQuestionCompleteOrNot:) withObject:#"No"];

Related

Not see image after shared article to Facebook with FBSDKShareOpenGraphObject

I try to shared image to Facebook and I need that the app name was be in the shared post in Facebook
this is the code :
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
UIImage *image1 = [GeneralMethods imageConvertToSizeWithImage:postImageView.image scaledToWidth:300];
photo.image = [UIImage imageNamed:#"VImage.png"];
photo.userGenerated = YES;
NSDictionary *properties = #{
#"og:type": #"article",
#"og:title": #"new item",
#"og:description": #"bla bla",
// #"og:image": #[photo],
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// [object setPhoto:photo forKey:#"og:image"];
// Create an action
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = #"news.publishes";
[action setObject:object forKey:#"article"];
// Add the photo to the action. Actions
// can take an array of images.
[action setArray:#[photo] forKey:#"image"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = #"article";
[FBSDKShareDialog showFromViewController:ParetDelaget withContent:content delegate:self];
this is Facebook preview page with the image i add:
this is the post in my Facebook wall without image :
whats I do wrong ?
Uncomment this line:
// #"og:image": #[photo],
And comment this one:
[action setArray:#[photo] forKey:#"image"];
Like this you will have both image, title and description showing.
A little remark: the photo object must be a string URL
In my case, here is the resulting code:
// Create an object
NSDictionary *properties = #{
#"og:type": #"article",
#"og:url": #"https://the_link_you_want.com",
#"og:title": #"your title",
#"og:description": #"your description",
#"og:image": #"http://url_to_your_image"
};
FBSDKShareOpenGraphObject *object = [FBSDKShareOpenGraphObject objectWithProperties:properties];
// Create an action
FBSDKShareOpenGraphAction *action = [[FBSDKShareOpenGraphAction alloc] init];
action.actionType = #"news.publishes";
[action setObject:object forKey:#"article"];
// Create the content
FBSDKShareOpenGraphContent *content = [[FBSDKShareOpenGraphContent alloc] init];
content.action = action;
content.previewPropertyName = #"article";
FBSDKShareDialog *shareDialog = [[FBSDKShareDialog alloc] init];
shareDialog.fromViewController = self;
shareDialog.shareContent = content;
[shareDialog show];
if (![shareDialog canShow]) {
// update the app UI accordingly
}
NSError *error;
if (![shareDialog validateWithError:&error]) {
NSLog(#"FB Error: %#", error);
}
Hope that helps

How To Limit The Amount Of Notifications

I have 3 separate ibeacons placed in 3 different rooms. When entering the region of the beacon the didRangeBeacon method runs every second, Thus resulting in an infinite number of notifications when in range.
This is the code i have:
BOOL _isInsideRegion;
- (void)locationManager:(CLLocationManager*)manager didRangeBeacons:(NSArray*)beacons inRegion:(CLBeaconRegion*)region {
CLBeacon *firstBeacon = [beacons firstObject];
int major = [firstBeacon.major intValue];
int minor = [firstBeacon.minor intValue];
if (major == 43005 && minor == 52679) {
if (!_isInsideRegion) {
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.soundName = #"Default";
notification.alertBody = #"Green";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
self.beaconColour.text = #"Green";
self.minor.text = [NSString stringWithFormat:#"%D", minor];
self.major.text = [NSString stringWithFormat:#"%D", major];
}
}
else if (major == 48891 && minor == 47852) {
if (!_isInsideRegion) {
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.soundName = #"Default";
notification.alertBody = #"blue";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
self.beaconColour.text = #"Blue";
self.minor.text = [NSString stringWithFormat:#"%D", minor];
self.major.text = [NSString stringWithFormat:#"%D", major];
}
}
else if (major == 59510 && minor == 42953) {
if (!_isInsideRegion) {
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.soundName = #"Default";
notification.alertBody = #"dark blue";
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];
self.beaconColour.text = #"Dark Blue";
self.minor.text = [NSString stringWithFormat:#"%D", minor];
self.major.text = [NSString stringWithFormat:#"%D", major];
}
}
}
Can anybody help me so that it gives one notification upon entry, and that when i then walk to the next beacon i get another notification specific to that beacon.
Thanks.
Use the locationManager:didEnterRegion: method.
This method is called when the user enters a beacon region defined by your app.
- (void)locationManager:(CLLocationManager *)manager
didEnterRegion:(CLBeaconRegion *)region {
NSLog(#"Did Enter Region for %#", region.identifier);
//Show Notification
}

An Objective-C message was sent to a deallocated 'UITransitionView' object (zombie) at address: 0x1f120730

I'm facing this issue seldon on this line in the image.
So please help me out. I've spend too much to find out. But i'm not able to find out it.
This is the actual error [UITransitionView isDescendantOfView:]: message sent to deallocated
This is the method in which im doing..
-(void)loadImageAtURLing:(UITapGestureRecognizer*)recogniser
{
[MBProgressHUD hideAllHUDsForView:appDelegate.window animated:YES];
int imgTag = [recogniser.view tag];
NSString *str = [arrDropPinId objectAtIndex:imgTag];
urlString = [arrLargePhoto objectAtIndex:imgTag];
NSLog(#"Larget Image %#",arrLargePhoto);
self.pdvc = [[PhotoDetailVC alloc] init];
self.pdvc.isFromTVView = NO;
if([urlString rangeOfString:#".mp4"].location == NSNotFound)
{
NSString *strImage = [arrLargePhoto objectAtIndex:imgTag];
NSRange lastValue = [strImage rangeOfString:#"300" options:NSBackwardsSearch];
if(lastValue.location != NSNotFound) {
strImage = [strImage stringByReplacingCharactersInRange:lastValue
withString: #"800"];
}
self.pdvc.isVideo = NO;
self.pdvc.imgURL = [strImage copy];
self.pdvc.pinIdStr = [str copy];
self.pdvc.imageURLArr = [arrLargePhoto mutableCopy];
self.pdvc.btnIndex = imgTag;
}
else
{
self.pdvc.isVideo = YES;
self.pdvc.imgURL = [urlString copy];
self.pdvc.pinIdStr = [str copy];
self.pdvc.btnIndex = imgTag;
NSLog(#"DropPIn ARR %#",arrCheckPinId);
}
[self presentViewController:self.pdvc animated:NO completion:nil];
}
Finally i got the solution. Because this is happening UITransitionView and UITransitionWrapperView not setting the frame. So i've done this
self.tabBarController.view.superview.frame = self.view.bounds;

UI issues in UITabBarController

here is the source code
problem: TabbarController is not working properly...
please help me
NSArray *actionButtonItems = #[searchItem, refreshItem];
self.navigationItem.rightBarButtonItems = actionButtonItems;
NSMutableArray *items = [[NSMutableArray alloc] init];
[items addObject:[[UITabBarItem alloc]
initWithTabBarSystemItem:UITabBarSystemItemHistory tag:1]];
[items addObject:[[UITabBarItem
alloc]initWithTabBarSystemItem:UITabBarSystemItemContacts tag:2]];
tabBar.items = items;
tabBar.delegate = self;
addFriends = [[AddFriendsViewController alloc] initWithNibName:#"AddFriendsViewController" bundle:nil];
[self.tabView addSubview:addFriends.view];
//[self.tabsetSelectedIndex = 0];
_tabBarController.selectedIndex = 0;
[self.view addSubview:_tabBarController.view];
Before you call
[self.tabView addSubview:addFriends.view];
you should call
[self.tabView setViewControllers:[NSArray arrayWithObjects: addFriends, nil]];
Set selectedViewController property of UITabBarController:
self.myTabBarController.selectedViewController = myViewController;
Use as below
self.myTabBarController.selectedViewController
= [self.myTabBarController.viewControllers objectAtIndex:0];

Real memory utilization Vrs "Live" Memory in XCODE tools

Our application uses the GPUImage Framework to process images. We're utilizing just about every filter and blend mode within the framework. We're allocating and releasing memory as we should. But, in spite of the fact that our "Live" memory stays at about 2.5MB sometimes spiking to 10MB but dropping back to 2.5MB, the app, will without a doubt, crash after saving about 13 images out that use overlays or borders. So, in digging into the issue and being completely dumb founded by it, I saw something that said "check out the activity monitor for your "REAL" memory use". So I did only to find that the "Real" memory was climbing up and up until at around 250MB real and 480MB virtual the app will crash. I am releasing my mem as I should be. How can I determine what is consuming all of this memory and crashing my app when the "Live" memory stays perfect and I can drill into it, but, the "REAL" memory in the activity monitor climbs out of control and has no way of drilling into it?
Here is the code we're using to process the images. This will take the image, send it to the first filter, allocate the filter, process the image, release the allocated filter then send the processed image to the next filter for processing depending upon what filters are enabled or not. If I'm doing something wrong here I welcome all criticism and suggestions! I am no Pro! As far as I'm concerned, processing 13 images of the size 1536 x 2048 should not crash the app, ever, if you're handling your memory properly. Thank you so much in advance for saving what's left of my hair.
Jim
-(id)processFilters{
NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init];
self.previewView.image = [UIImage imageWithContentsOfFile:[self.documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:#"thumb_%#", self.file]]];
if (sephiaFilterEnabled){
sephiaFilter = [[GPUImageSepiaFilter alloc] init];
[(GPUImageSepiaFilter *)sephiaFilter setIntensity:[_filterSephiaSlider value]];
self.previewView.image = [sephiaFilter imageByFilteringImage:previewView.image];
[sephiaFilter release];
}
if (saturationFilterEnabled){
saturationFilter = [[GPUImageSaturationFilter alloc] init];
[(GPUImageSaturationFilter *)saturationFilter setSaturation:[_filterSaturationSlider value]];
self.previewView.image = [saturationFilter imageByFilteringImage:previewView.image];
[saturationFilter release];
}
if (contrastFilterEnabled){
contrastFilter = [[GPUImageContrastFilter alloc] init];
[(GPUImageContrastFilter *)contrastFilter setContrast:[_filterContrastSlider value]];
self.previewView.image = [contrastFilter imageByFilteringImage:previewView.image];
[contrastFilter release];
}
if (brightnessFilterEnabled){
brightnessFilter = [[GPUImageBrightnessFilter alloc] init];
[(GPUImageBrightnessFilter *)brightnessFilter setBrightness:[_filterBrightnessSlider value]];
self.previewView.image = [brightnessFilter imageByFilteringImage:previewView.image];
[brightnessFilter release];
}
if (exposureFilterEnabled){
exposureFilter = [[GPUImageExposureFilter alloc] init];
[(GPUImageExposureFilter *)exposureFilter setExposure:[_filterExposureSlider value]];
self.previewView.image = [exposureFilter imageByFilteringImage:previewView.image];
[exposureFilter release];
}
if (sharpenFilterEnabled){
sharpenFilter = [[GPUImageSharpenFilter alloc] init];
[(GPUImageSharpenFilter *)sharpenFilter setSharpness:[_filterSharpenSlider value]];
self.previewView.image = [sharpenFilter imageByFilteringImage:previewView.image];
[sharpenFilter release];
}
if (vignetteFilterEnabled){
vignetteFilter = [[GPUImageVignetteFilter alloc] init];
[(GPUImageVignetteFilter *)vignetteFilter setVignetteEnd:[_filterVignetteSlider value]];
self.previewView.image = [vignetteFilter imageByFilteringImage:previewView.image];
[vignetteFilter release];
}
if (gBlurFilterEnabled){
if(blurRadialEnabled){
gBlurFilter = [[GPUImageGaussianSelectiveBlurFilter alloc] init];
float yy;
float xx;
yy = blurToPoint.y / 320;
xx = blurToPoint.x / 240;
//NSLog (#"%f %f", xx, yy);
if(blurToPoint.x == 0 && blurToPoint.y == 0){
xx = 0.5;
yy = 0.5;
}
[(GPUImageGaussianSelectiveBlurFilter *)gBlurFilter setExcludeCirclePoint:CGPointMake(xx, yy)];
[(GPUImageGaussianSelectiveBlurFilter *)gBlurFilter setExcludeCircleRadius:[_filterGBlurSlider value]];
[(GPUImageGaussianSelectiveBlurFilter *)gBlurFilter setExcludeBlurSize:0.6];
self.previewView.image = [gBlurFilter imageByFilteringImage:previewView.image];
[gBlurFilter release];
}else if(blurBoxEnabled){
gBlurBoxFilter = [[GPUImageBoxBlurFilter alloc] init];
self.previewView.image = [gBlurBoxFilter imageByFilteringImage:previewView.image];
[gBlurBoxFilter release];
}else if(blurTiltEnabled){
gBlurTiltFilter = [[GPUImageTiltShiftFilter alloc] init];
float yy;
yy = blurToPoint.y / 320;
if(blurToPoint.y == 0){
yy = 0.5;
}
[(GPUImageTiltShiftFilter *)gBlurTiltFilter setTopFocusLevel:yy - [_filterTiltBlurSlider value]];
[(GPUImageTiltShiftFilter *)gBlurTiltFilter setBottomFocusLevel:yy + [_filterTiltBlurSlider value]];
self.previewView.image = [gBlurTiltFilter imageByFilteringImage:previewView.image];
[gBlurTiltFilter release];
}
}
if (cropFilterEnabled){
cropFilter = [[GPUImageCropFilter alloc] init];
float wBuff = [_filterCropSlider value] * cropToPoint.x;
float hBuff = [_filterCropSlider value] * cropToPoint.y;
float xp = cropToPoint.x - wBuff;
float yp = cropToPoint.y - hBuff;
float t1 = xp * [_filterCropSlider value];
float t2 = yp * [_filterCropSlider value];
xp = xp + (t1 * 4);
yp = yp + (t2 * 3.5);
xp = xp / 1000;
yp = yp / 1000;
//NSLog(#"%f, x: %f y: %f wB: %f hB: %f", [_filterCropSlider value], xp, yp, wBuff, hBuff);
[(GPUImageCropFilter *)cropFilter setCropRegion:CGRectMake(xp, yp, [_filterCropSlider value], [_filterCropSlider value])];
self.previewView.image = [cropFilter imageByFilteringImage:previewView.image];
[cropFilter release];
}
if (kuwaharaFilterEnabled){
kuwaharaFilter = [[GPUImageKuwaharaFilter alloc] init];
[(GPUImageKuwaharaFilter *)kuwaharaFilter setRadius:round([_filterKuwaharaSlider value])];
self.previewView.image = [kuwaharaFilter imageByFilteringImage:previewView.image];
[kuwaharaFilter release];
}
if (toonFilterEnabled){
toonFilter = [[GPUImageToonFilter alloc] init];
self.previewView.image = [toonFilter imageByFilteringImage:previewView.image];
[toonFilter release];
}
if (invertFilterEnabled){
invertFilter = [[GPUImageColorInvertFilter alloc] init];
self.previewView.image = [invertFilter imageByFilteringImage:previewView.image];
[invertFilter release];
}
if (pixelFilterEnabled){
pixelFilter = [[GPUImagePixellateFilter alloc] init];
[(GPUImagePixellateFilter *)pixelFilter setFractionalWidthOfAPixel:[_filterPixelSlider value]];
self.previewView.image = [pixelFilter imageByFilteringImage:previewView.image];
[pixelFilter release];
}
if (gammaFilterEnabled){
gammaFilter = [[GPUImageGammaFilter alloc] init];
[(GPUImageGammaFilter *)gammaFilter setGamma:[_filterGammaSlider value]];
self.previewView.image = [gammaFilter imageByFilteringImage:previewView.image];
[gammaFilter release];
}
if (sketchFilterEnabled){
sketchFilter = [[GPUImageSketchFilter alloc] init];
self.previewView.image = [sketchFilter imageByFilteringImage:previewView.image];
[sketchFilter release];
}
if (swirlFilterEnabled){
swirlFilter = [[GPUImageSwirlFilter alloc] init];
[(GPUImageSwirlFilter *)swirlFilter setAngle:[_filterSwirlSlider value]];
self.previewView.image = [swirlFilter imageByFilteringImage:previewView.image];
[swirlFilter release];
}
if (overlayFilterEnabled){
if (![self.overlayImage compare:#""] == NSOrderedSame){
GPUImageOutput<GPUImageInput> *overlayFilter;
if(multiplyBlendEnabled){
overlayFilter = [[GPUImageMultiplyBlendFilter alloc] init];
}else if(overlayBlendEnabled){
overlayFilter = [[GPUImageOverlayBlendFilter alloc] init];
}else if(lightenBlendEnabled){
overlayFilter = [[GPUImageLightenBlendFilter alloc] init];
}else if(darkenBlendEnabled){
overlayFilter = [[GPUImageDarkenBlendFilter alloc] init];
}else if(burnBlendEnabled){
overlayFilter = [[GPUImageColorBurnBlendFilter alloc] init];
}else if(dodgeBlendEnabled){
overlayFilter = [[GPUImageColorDodgeBlendFilter alloc] init];
}else if(screenBlendEnabled){
overlayFilter = [[GPUImageScreenBlendFilter alloc] init];
}else if(differenceBlendEnabled){
overlayFilter = [[GPUImageDifferenceBlendFilter alloc] init];
}else if(subtractBlendEnabled){
overlayFilter = [[GPUImageSubtractBlendFilter alloc] init];
}else if(exclusionBlendEnabled){
overlayFilter = [[GPUImageExclusionBlendFilter alloc] init];
}else if(hardLightBlendEnabled){
overlayFilter = [[GPUImageHardLightBlendFilter alloc] init];
}else if(softLightBlendEnabled){
overlayFilter = [[GPUImageSoftLightBlendFilter alloc] init];
}else{
overlayFilter = [[GPUImageMultiplyBlendFilter alloc] init];
}
UIImage *inputImage = [[[UIImage alloc]init]autorelease];
// The picture is only used for two-image blend filters
inputImage = [UIImage imageNamed:[NSString stringWithFormat:#"preview_%#.jpg", self.overlayImage]];
GPUImagePicture *sourcePreviewPicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
[sourcePreviewPicture addTarget:overlayFilter];
inputImage = [overlayFilter imageByFilteringImage:self.previewView.image];
if(overlayOpacityFilterEnabled){
GPUImageOutput<GPUImageInput> *overlayOpacityFilter = [[GPUImageAlphaBlendFilter alloc] init];
sourcePreviewPicture = [[GPUImagePicture alloc] initWithImage:self.previewView.image smoothlyScaleOutput:YES];
[sourcePreviewPicture addTarget:overlayOpacityFilter];
[(GPUImageAlphaBlendFilter *)overlayOpacityFilter setMix:[_filterOverlayOpacitySlider value]];
inputImage = [overlayOpacityFilter imageByFilteringImage:inputImage];
[overlayOpacityFilter release];
}
self.previewView.image = inputImage;
[overlayFilter release];
[sourcePreviewPicture release];
}
}
if (borderFilterEnabled){
if (![self.borderImage compare:#""] == NSOrderedSame){
GPUImageOutput<GPUImageInput> *borderFilter;
if ([self.borderImage rangeOfString:#"black"].location == NSNotFound) {
borderFilter = [[GPUImageLightenBlendFilter alloc] init];
} else {
borderFilter = [[GPUImageMultiplyBlendFilter alloc] init];
}
UIImage *inputImage = [[[UIImage alloc]init]autorelease];
// The picture is only used for two-image blend filters
inputImage = [UIImage imageNamed:[NSString stringWithFormat:#"preview_%#.jpg", self.borderImage]];
GPUImagePicture *sourcePreviewPicture = [[GPUImagePicture alloc] initWithImage:inputImage smoothlyScaleOutput:YES];
[sourcePreviewPicture addTarget:borderFilter];
self.previewView.image = [borderFilter imageByFilteringImage:self.previewView.image];
[borderFilter release];
[sourcePreviewPicture release];
}
}
[loopPool drain];
return self.previewView.image;
}