Skip to content

Conversation

@Sneakr
Copy link

@Sneakr Sneakr commented Oct 18, 2016

Changed bad recreation of UIImageViews on every movement frequency cycle and saves performance.

Copy link
Owner

@calonso calonso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch realising that we don't need to reload the images everytime. It should have a CPU impact for sure. Just a minor comments in order to keep it even simpler.

Thanks, great work!


- (void)updateLocations:(NSTimer *)timer {
[radar updatePoints:centerCoordinate];
[radar updatePoints:centerCoordinate reloadData:NO];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is never invoked with YES then, I'd remove the new argument.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reloaddata wont be called here, but if you want to call it manually you could call it somewhere else from superview on data changes without reallocating everything.

}

// Only remove subviews if reloading the data with new points
if (reloadData) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data will never be reloaded so remove this bit. Instead I'd check somehow that if this is the first call (i.e., no dots in the dotsView), then dot views have to be created.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point was for compatibility if you want to invoke reloaddata from superview without reallocating the entire radarview from beginning, for example you change positions and want to change the number of points.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is needed at some point then it will be added. For now I'd rather keep it the simplest. :)

UIImageView *point;

// Only create new imageviews if reloaddata or initial load
if (points.count != dotsView.subviews.count) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All dot views will already be created (from line 40), so we just need to point = [dotsView.subviews objectAtIndex:count]; here.

point = [dotsView.subviews objectAtIndex:count];
}

point.tintColor = [UIColor redColor];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why red?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot to clean that part , it was more of an indicator if you want to change the standard color of the image.

@calonso
Copy link
Owner

calonso commented Oct 27, 2016

Hi @Sneakr how are you doing with this? Do you need any help?
Come on, just one more effort and we'll get this merged!

@Sneakr
Copy link
Author

Sneakr commented Oct 28, 2016

@calonso hey, I asked what to do to get this merged , maybe you miseed that message, this is my first pull request if you can point me in direction I can finish it of course, not sure what to do from here lol!

@calonso
Copy link
Owner

calonso commented Oct 28, 2016

Ok, so the way this works is that normally you go through my comments fixing them, commit and push changes again, I review and make comments and so on until we get to a point where we are both happy with the final result and we merge it. Hopfeully it won't take very long to get to this point as your changes are quite good already and my comments are just minor ones.

@calonso
Copy link
Owner

calonso commented Nov 30, 2016

Hey @Sneakr how are you doing? Do you need any help with this?
I really like your work, just a few fixes and we'll get it merged!

@Sneakr
Copy link
Author

Sneakr commented Dec 1, 2016

Hey man, Sorry for the delay im not very active, This github interface really makes me dizzy, my I get brainfreeze from everything here, you are free to just copy the edits and make the improvments as you wish and merge it!

@calonso
Copy link
Owner

calonso commented Dec 2, 2016

That's a pity man, we were so close, just a couple of minor comments...
I'll keep it here should you find energy in the weekend ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants