Im trying to get the label and images of each item in my plist library to show up in my details tab.
Here is a pic of my tableview which i can get my plist dictionary to work. An array of images and an array or items. (ex item 0 is both the thermostat.jpg and Thermostat label.
Here is a pic of the detail view when clicking on the cell. It pulls the label from the cell and the image of the thermostat.
However when clicking on item 1 in plist (the toilet) it pulls the toilet name but still shows the thermostat image. Like so.
Here is my code for detailviewcontroller
the.h
#import <Foundation/Foundation.h>
#interface DetailViewController : UIViewController
{
IBOutlet UIScrollView *scrollView;
}
#property (nonatomic, strong) IBOutlet UILabel *itemLabel;//Name of that view
#property (nonatomic, strong) NSString *itemName;
#property (nonatomic, strong) IBOutlet UIImageView *myImageView; //Image View
#property (strong, nonatomic) IBOutlet UILabel *myTextView; //Description View
#end
and .m
#import "DetailViewController.h"
#interface DetailViewController ()
#end
#implementation DetailViewController
#synthesize itemLabel;
#synthesize itemName;
#synthesize myImageView;
#synthesize myTextView;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
itemLabel.text = itemName;
//**************SCROLL VIEW*************
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320,960)];
scrollView.contentInset=UIEdgeInsetsMake(0.0,0.0,90.0,0.0);
////I know below this is the Problem, BUT im not sure what its supposed to be?////
NSDictionary *picturesDictionary = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:#"repairlist" ofType:#"plist"]];
NSArray *imageArray = [picturesDictionary objectForKey:#"Thumbnail"];
myImageView.image = [UIImage imageNamed:[imageArray objectAtIndex:0]];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#end
So all in all im trying to get the image to correctly show when clicking on that cell
Here is an image of my plist im using:
I already have this in my TableViewController
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([segue.identifier isEqualToString:#"ItemListCell"]) {
DetailViewController *destViewController = segue.destinationViewController;
NSIndexPath *indexPath = nil;
if ([self.searchDisplayController isActive]) {
indexPath = [self.searchDisplayController.searchResultsTableView indexPathForSelectedRow];
destViewController.itemName = [searchResults objectAtIndex:indexPath.row];
} else {
indexPath = [self.myTableView indexPathForSelectedRow];
destViewController.itemName = [repairList objectAtIndex:indexPath.row];
//destViewController.textView = [descrip objectAtIndex:indexPath.row];
}
}
}
Here is your problem,
myImageView.image = [UIImage imageNamed:[imageArray objectAtIndex:0]];
You set your image always the same index which is 0. So, logically, you're always seeing the same image. So, what you need to is that you need to detect which cell was selected before you push DetailViewController and pass that info to your DetailViewController. Then, you need to use that info to show appropriate image in your DetailViewController.
First, you need to declare a property in DetailViewController.h,
#property int selectedRow;
change also this line of code
myImageView.image = [UIImage imageNamed:[imageArray objectAtIndex:0]];
to
myImageView.image = [UIImage imageNamed:[imageArray objectAtIndex:self.selectedRow]];
Then in your TableViewController.m
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:#"YourSegueIdentifier"]) {
NSIndexPath *selectedRowIndex = [self.tableView indexPathForSelectedRow];
DetailViewController *detailViewController = [segue destinationViewController];
detailViewController.selectedRow = [dataController objectInListAtIndex:selectedRowIndex.row];
}
}
Related
I am new on objective c and I am trying to set image of UIImageview while pushing viewcontroller
I checked other answer and I did the same way they said it but its not working for me below is my code and i will explain other things in it
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DetailViewController *svController = [[DetailViewController alloc] initWithNibName:#"DetailViewController" bundle:[NSBundle mainBundle]];
UIImage *image = [UIImage imageNamed:#"default.png"];
UIImageView* imageview = [[UIImageView alloc] initWithImage:image];
id obj = [[mainArray valueForKey:#"image"] objectAtIndex:[indexPath row]];
if ([obj isKindOfClass:[NSString class]])
{
NSLog(#" image%#",image); //print this image<UIImage: 0xaa70700>
NSLog(#" image%#",svController.image); //print this image(null)
[[svController image] setImage: image];
NSLog(#" image%#",svController.image); //print this image(null)
}
else {
NSLog(#" image%#",svController.image);
[[svController image] setImage: [[mainArray valueForKey:#"image"] objectAtIndex:[indexPath row]]];
NSLog(#" image%#",svController.image);
}
[self.navigationController pushViewController:svController animated:YES];
[svController release];
svController = nil;
}
below is my detailviewcontroller
#interface DetailViewController : UIViewController{
UIImageView *image;
}
#property (retain, nonatomic) IBOutlet UIImageView *image;
its connected to Xib and i have synthesized it
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
name.text = nameString;
email.text = emailString;
NSLog(#"%#",image); // print this <UIImageView: 0x9d73950; frame = (27 35; 204 181); autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x9db4050>>
}
its working perfectly when i send NSString and set them on my lable but not working for image it its so small thing but now i dont know what to do please help
hear is the simple way, i am showing the example that u can set image in detail view controller
in your master view controller
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row == 0)//for 1st row
{
DetailViewController *detController = [[DetailViewController alloc]initWithNibName:#"DetailViewController" bundle:nil];
detController.detailImage = [UIImage imageNamed:#"abc.png"];//setting the property for image
[self.navigationController pushViewController:detController animated:YES];
[detController release];//im doing without ARC
}
else if (indexPath.row == 1)
{
DetailViewController *detController = [[DetailViewController alloc]initWithNibName:#"DetailViewController" bundle:nil];
detController.detailImage = [UIImage imageNamed:#"123.png"];
[self.navigationController pushViewController:detController animated:YES];
[detController release];//im doing without ARC
}
}
and in your detail view controller
// .h file
#interface DetailViewController : UIViewController
{
}
#property (retain, nonatomic) IBOutlet UIImageView *ImageView;
#property (nonatomic, retain)UIImage * detailImage;//set a property for image that u are passing from master viewcontroller
#end
//in .m file
#implementation DetailViewController
#synthesize detailImage; //synthesise it
// and in viewDidload method
- (void)viewDidLoad
{
[super viewDidLoad];
//set your passed image to image view
self.ImageView.image = self.detailImage;
}
Better would be just do like this:
[self.navigationController pushViewController:svController animated:YES];
if(yourImage) //got UIImage reference then only set it
svController.yourImgView.image = yourImageHere
.................
<<Another code here>>
..............
Thats it....
You can't do this, because svController's view has not been loaded at the time you try to set the image of its image view (so the image view will be null).
You need to pass the image itself to a property you create in svController, and set the image in svController's viewDidLoad method.
Set your UI object intialization afer pushing view controller.
[self.navigationController pushViewController:svController animated:YES];
//set image here
Reason is viewDidLoad of svController will not be called and loaded yet and imageview will not have reference yet.
EDIT :
Better would be just do like this:
[self.navigationController pushViewController:svController animated:YES];
if(yourImage) //got UIImage reference then only set it
svController.yourImgView.image = yourImageHere
.................
<<Another code here>>
..............
Thats it....
In this code a user gets and displays a photo (provided for now) in ImageViewController, adds a caption, and the the photo and caption are passed to the MTViewcontroller where it is made into a pdf. I have solved the PDF portion, but struggling with the segue. Appreciate any guidance. I can't find an example quite like this.
ImageViewController.h
#import <UIKit/UIKit.h>
#interface ImageViewController : UIViewController
{
NSURL *url;
UIImage *imageRoll;
}
#property (strong, nonatomic) IBOutlet UIWebView *webView;
#property (strong, nonatomic) IBOutlet UITextField *enterCaption;
- (IBAction)Button:(id)sender;
#end
ImageViewController.m Not sure I'm treating imageRoll correctly and I can't find the right segue format for this. Once the user, submits the caption it would segue to the PDF controller. BUT, would the keyboard release given the segue?
- (void)viewDidLoad
{
[super viewDidLoad];
// Since iPhone simulator doesn't have photos, load and display a placeholder image
NSString *fPath = [[NSBundle mainBundle] pathForResource:#"IMG_3997" ofType:#"jpg"];
url = [NSURL fileURLWithPath:fPath];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
UIImage *imageRoll = [UIImage imageWithContentsOfFile:fPath];
}
// User provides a caption for the image
- (IBAction)Button:(id)sender {
NSString *caption = enterCaption.text;
[self performSegueWithIdentifier:#"showPDF" sender:sender];
MTViewController *vc1 = [segue destinationViewController];
vc1.photoCaption = caption;
MTViewController *vc2 = [segue destinationViewController];
vc2.photoImage = imageRoll;
}
//Dismiss Keyboard
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[textField resignFirstResponder];
return YES;
}
MTViewController.h
#import <UIKit/UIKit.h>
#import "ReaderViewController.h"
#interface MTViewController : UIViewController <ReaderViewControllerDelegate>
#property(nonatomic, assign) NSString *photoCaption;
#property(nonatomic, assign) UIImage *photoImage;
- (IBAction)didClickMakePDF:(id)sender;
#end
MTViewController.m Have I passed and used photoCaption and photoImage correctly?
- (IBAction)didClickMakePDF {
[self setupPDFDocumentNamed:#"NewPDF" Width:850 Height:1100];
[self beginPDFPage];
CGRect textRect = [self addText:photoCaption
withFrame:CGRectMake(kPadding, kPadding, 400, 200) fontSize:48.0f];
CGRect blueLineRect = [self addLineWithFrame:CGRectMake(kPadding, textRect.origin.y + textRect.size.height + kPadding, _pageSize.width - kPadding*2, 4)
withColor:[UIColor blueColor]];
UIImage *anImage = [UIImage imageNamed:#"photoImage"];
CGRect imageRect = [self addImage:anImage
atPoint:CGPointMake((_pageSize.width/2)-(anImage.size.width/2), blueLineRect.origin.y + blueLineRect.size.height + kPadding)];
[self addLineWithFrame:CGRectMake(kPadding, imageRect.origin.y + imageRect.size.height + kPadding, _pageSize.width - kPadding*2, 4)
withColor:[UIColor redColor]];
[self finishPDF];
}
updated:
You should use self.xxx = xxx to save it in one method and get it back in another method by using self.xxx. For example you should use
self.imageRoll = [UIImage imageWithContentsOfFile:fPath];
instead of declaring a new imageRoll in your code. And it's the same with your caption.
The way you use segue is incorrect.
The way you call [self performSegueWithIdentifier:#"showPDF" sender:sender]; is correct. But then you can do some customization in
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:#"showPDF"]) {
MTViewController *vc1 = [segue destinationViewController];
vc1.photoCaption = self.caption;
vc1.photoImage = self.imageRoll;
}
}
i have a TableView with some Names.
And i want to show these Names on an other ViewController, but i donĀ“t get it.
Here is my code:
AnguckenViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UIViewController *DetailViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"DetailViewController"];
AnguckenViewController *DetailKey = [self.originalsource objectAtIndex:[tableView indexPathForSelectedRow].row];
const char *cPlainKey = [DetailKey cStringUsingEncoding:NSASCIIStringEncoding];
NSString *plistPath;
NSString *rootPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES) objectAtIndex:0];
NSString *pszDetailValueString = [NSString stringWithFormat:#"%s",szSafeKey];
NSString *szDetailValue = [temp objectForKey:pszDetailValueString];
[DetailViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:DetailViewController animated:YES completion:^(void){}];
}
DetailViewController.h
#import <UIKit/UIKit.h>
#interface DetailViewController : UIViewController {
IBOutlet UIButton *BackButton;
NSString *_pszKey;
NSString *_pszValue;
}
#property (nonatomic, retain) NSString *pszKey;
#property (nonatomic, retain) NSString *pszValue;
#property (retain, nonatomic) IBOutlet UILabel *keyLabel;
#property (retain, nonatomic) IBOutlet UILabel *valueLabel;
#end
DetailViewController.m
#implementation DetailViewController
#synthesize pszKey;
#synthesize pszValue;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_keyLabel.text = _pszKey;
}
You need to set the pszKey property of the view controller, e.g. the DetailViewController, before you display it modally.
DetailViewController.pszKey = #"The value";
[DetailViewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:DetailViewController animated:YES completion:^(void){}];
And also in the viewDidLoad, it is good to use the getter of the properties instead of accessing the instance variables directly:
- (void)viewDidLoad
{
[super viewDidLoad];
self.keyLabel.text = self.pszKey;
}
So finally it works,
i changed the line:
UIViewController *DetailViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"DetailViewController"];
to:
DetailViewController *DetailViewController = [self.storyboard instantiateViewControllerWithIdentifier:#"DetailViewController"];
Thanks
I am parsing JSON using AFNetworking.
i passed 2 images and text from one view to another but i cant view the image on the UIImage view.
I can see the link of the images on the console.
here is my code (link to github)
#import "KKDetailsViewController.h"
#interface KKDetailsViewController ()
#end
#implementation KKDetailsViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.textView.text = [self.importVideoMetaData objectForKey:#"description"];
self.imageView.image = [[UIImage alloc] init];
self.imageView.image = [UIImage imageNamed:[(NSDictionary *)self.importThumbnail objectForKey:#"hqDefault"]];
NSLog(#" imported thumbnail %#", self.importThumbnail);
}
here is the .h file
#import <UIKit/UIKit.h>
#interface KKDetailsViewController : UIViewController
#property (weak, nonatomic) NSDictionary *importVideoMetaData;
#property (weak, nonatomic) NSDictionary *importThumbnail;
#property (weak, nonatomic) IBOutlet UITextView *textView;
#property (weak, nonatomic) IBOutlet UIImageView *imageView;
#end
ok here is how i made it work:
- (void)viewDidLoad
{
[super viewDidLoad];
self.textView.text = [self.importVideoMetaData objectForKey:#"description"];
NSURL *url = [[NSURL alloc] initWithString:[self.importThumbnail objectForKey:#"hqDefault"]];
[self.imageView setImageWithURL:url placeholderImage:[UIImage imageNamed:#"fakeThumbnail.png"]];
NSLog(#" imported thumbnail %#", url);
}
I am currently dynamically adding a UIImage to my UIScrollView object and everything is working as intended. I need to add extra functionality now (a UIActivityIndicator in the center of the image when it is loading from the internet, and a label underneath) so I thought why not create a custom View which has all of these laid out as I need them to be, and then just load it into the scrollView. I have encountered a problem though, when I add it to the scrollView, nothing shows up. Here is what I have:
NewsViewController.m:
imageScrollView.contentSize = CGSizeMake(320*numberOfPages, 303);
pageControl.numberOfPages = numberOfPages;
dispatch_queue_t imageDownload = dispatch_queue_create("imageDownload", NULL);
__block NSData *temp;
CustomImageView *customImageView = [[CustomImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 303)];
[imageScrollView addSubview:customImageView];
[[customImageView activityIndicator] startAnimating];
dispatch_async(imageDownload, ^{
temp = [[NSData dataWithContentsOfURL:[NSURL URLWithString:#"http://www.wlfarm.org/wp-content/uploads/2012/05/farm.jpg"]]retain];
dispatch_async(dispatch_get_main_queue(), ^{
customImageView.imageView.image = [[UIImage alloc] initWithData:temp];
[[customImageView activityIndicator] stopAnimating];
[customImageView setNeedsDisplay];
customImageView.caption.text = #"HAHAHAHAHHAHA";
[imageScrollView setNeedsDisplay];
[temp release];
});
});
dispatch_release(imageDownload);
CustomImageView.h:
#import <UIKit/UIKit.h>
#interface CustomImageView : UIView
{
IBOutlet UIImageView *imageView;
IBOutlet UILabel *caption;
IBOutlet UIActivityIndicatorView *activityIndicator;
}
#property (nonatomic, retain) IBOutlet UIImageView *imageView;
#property (nonatomic, retain) IBOutlet UILabel *caption;
#property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator;
#end
CustomImageView.m
#import "CustomImageView.h"
#interface CustomImageView ()
#end
#implementation CustomImageView
#synthesize caption, imageView, activityIndicator;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
#end
I am including a screenshot of my XIB file, and the program running on the simulator. The first picture shows nothing in the scrollView(the attempt made by using my custom class), and the second page of the scroll view is the attempt made by adding a UIImageView to the UIScrollView(which worked). Can anyone point out what I am doing wrong? Am I not allowed to load a custom view into a UIScrollView? Thanks for your help!
IB Screenshot - http://i.stack.imgur.com/gz9UL.png
iOS Simulator No Image with CustomView Screenshot - http://i.stack.imgur.com/zhswq.png
iOS Simulator Image with UIImageView Screenshot - http://i.stack.imgur.com/97vmU.png
It looks as though CustomImageView is a subclass on UIViewController, not UIImageView or UIView. You can't add a UIViewController as a subview like that. change it to subclass UIView and it should work.
To load a UIView from a .nib, you need to declare your IBOutlet properties as you would for a UIViewController. Define the correct custom class in IB and connect everything up, including the base view. Then override the following method inside your custom view class.
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code.
//
[[NSBundle mainBundle] loadNibNamed:#"<NIB NAME HERE>" owner:self options:nil];
[self addSubview:self.view];
}
return self;
}
It seems you have cut and pasted methods from a UIViewController subclass into you UIView subclass. Start by deleting all the methods you've pasted in between #synthesize and #end . A UIView subclass requires different methods to to load from a .nib, so you need to override the method shown above instead and use the line of code
[[NSBundle mainBundle] loadNibNamed:#"<NIB NAME HERE>" owner:self options:nil];
to load the nib.
Further to your comment about connecting the base view, here is what I mean:
After creating your custom class and nib file, open the nib and highlight "Files Owner" on the left, then on the top right hand side, select the icon 3rd from the left, looks like an ID card or something. In the "Class" box, add the name of your custom class.
In your customClass, add an IBOutlet UIView property called baseView, and add a UIView that covers the view in IB at the root level, connect these two. Then add everything else on top of that
you code would now look something like this:
CustomImageView.h
#import <UIKit/UIKit.h>
#interface CustomImageView : UIView
{
IBOutlet UIView *baseView
IBOutlet UIImageView *imageView;
IBOutlet UILabel *caption;
IBOutlet UIActivityIndicatorView *activityIndicator;
}
#property (nonatomic, retain) IBOutlet UIView *baseView;
#property (nonatomic, retain) IBOutlet UIImageView *imageView;
#property (nonatomic, retain) IBOutlet UILabel *caption;
#property (nonatomic, retain) IBOutlet UIActivityIndicatorView *activityIndicator;
#end
CustomImageView.m
#import "CustomImageView.h"
#interface CustomImageView ()
#end
#implementation CustomImageView
#synthesize baseView, caption, imageView, activityIndicator;
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
// Initialization code.
//
[[NSBundle mainBundle] loadNibNamed:#"<NIB NAME HERE>" owner:self options:nil];
[self addSubview:self.baseView];
}
return self;
}
#end
Provided you connect it all up in IB it should work fine, just remember to add the baseView
As mentioned earlier initWithNibName belongs to controllers.
As I think, you're going the wrong way.
you have a ViewController and want to add a customView, to load dynamically a image from URLData.
You have 2 Options:
Option 1: Do everything in IB:
In Interfacebuilder edit/(or add a new one) the ViewController's XIB File and add the views that you like. The file's owner is a UIViewController Class/Subclass. Do everything like you did before, except doing it in the view controller. In your App delegate initWithNibName your ViewController like so
self.viewController = [[testViewController alloc] initWithNibName:#"testViewController" bundle:nil];
If you want to, initialize your own view controller, which you like to push and push it in the stack.
What you're doing wrong: You are initializing a customImageView with a Frame, but the nib doesn't get loaded automatically. The Properties are there, but the nib isn't.
If you really want a stable thing choose
Option 2: Do everything programatically (It is easier, more understanding and lightweight):
From your implementation we do the following:
NewsViewController.m
Do like you did before!!!
CustomImageView.h:
#import <UIKit/UIKit.h>
#interface CustomImageView : UIView
{
UIImageView *imageView;
UILabel *caption;
UIActivityIndicatorView *activityIndicator;
}
#property (nonatomic, retain) UIImageView *imageView;
#property (nonatomic, retain) UILabel *caption;
#property (nonatomic, retain) UIActivityIndicatorView *activityIndicator;
#end
CustomImageView.m:
- (id)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// Initialization code
caption = [[UILabel alloc] initWithFrame:CGRectMake(0, 250, 320, 50)];
[caption setBackgroundColor:[UIColor greenColor]];
imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 250)];
[imageView setBackgroundColor:[UIColor blueColor]];
activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
self.activityIndicator.frame = CGRectMake(320/2-25, 460/2-25, 50, 50);
[self.activityIndicator startAnimating];
[self addSubview:self.caption];
[self addSubview:self.imageView];
[self addSubview:self.activityIndicator];
}
return self;
}
Then do everything you did before.
That would do a better job