Comments (4)
Cant Work out how this code attached system works (first timer!!!) But anyway the issue is in ELCAssetsCell.m -> Line number 17
Instead of:
if(self = [super initWithStyle:UITableViewStylePlain reuseIdentifier:_identifier]) { ....
It should be
if(self == [super initWithStyle:UITableViewStylePlain reuseIdentifier:_identifier]) {...
THere was a '==' missing which was hampering performance as cells were not being reused
from elcimagepickercontroller.
Hello adityamatharu,
That is actually a really common idiom in objective-c. At first it looks very weird, but that's actually a compound statement.
So if the original code looks like this:
if(self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:_identifier]) {
self.rowAssets = _assets;
}
It's assigning self to a new object, then checking that self is not nil. It's easier to see if we break that into two lines:
self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:_identifier];
if(self) {
self.rowAssets = _assets;
}
So, it's not actually a typo. That being said, I'm definitely interested in why that sped performance up for you.
Please do a pull of that latest code (we've recently pushed some changes) and try that. If performance is still a problem, please feel free to open a new issue.
Thanks!
from elcimagepickercontroller.
Hi chris
Thanks for the reply.
I actually meant the == sign. I know I'm inexperienced here but I thought to compare something you needed to have a == sign rather than just a = sign. That's what I did and that improved the performance. So I'm not sure if the compound statement still works with a single = sign rather than double.
But yeah I'll checkout the new code. One thing is for certain I was getting critical crash and slowdowns Due to running out of memory when I was using only single = sign
But it's really great you replied back :)
Thanks
Adi
Sent from my iPhone
On 13 Oct 2011, at 19:09, Chris [email protected] wrote:
Hello adityamatharu,
That is actually a really common idiom in objective-c. At first it looks very weird, but that's actually a compound statement.
So if the original code looks like this:
if(self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:_identifier]) {
self.rowAssets = _assets;
}It's assigning self to a new object, then checking that self in not nil. It's easier to see if we break that into two lines:
self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:_identifier]
if(self) {
self.rowAssets = _assets;
}So, it's not actually a typo. That being said, I'm definitely interested in why that sped performance up for you.
Please do a pull of that latest code, we've pushed some changes, and try that. If performance is still a problem, please feel free to open a new issue.
Thanks!
Reply to this email directly or view it on GitHub:
#11 (comment)
from elcimagepickercontroller.
Hi Aditya,
I checked the original version of the code and could find no leaks in Instruments. At least none showed up in my testing of albums with ~400 photos. It was pretty quick on ipod 4G but ipod 2G lagged quite a bit when trying to load so many photos. But that's to be expected.
Just to clarify, the if statement simply checks the validity of the expression. if (true) (i.e not nil in this case) it does something. In the case of self = [super initWithStyle:UITableViewCellStyleDefault reuseIdentifier:_identifier] within the if statement, the self will be assigned first and if it's nil (false) it won't execute the if code block but if it's not nil (true) the code block is executed normally. As you can see, it's similar to what would happen if you first assigned to self in a statement and then used the value of self in the if expression as a condition (see Chris's second example code in his reply).
HTH.
from elcimagepickercontroller.
Related Issues (20)
- Calling Images individually in different views, and saving images
- Important Features Request: Ability to specify existing selected images HOT 1
- large memory consumption HOT 2
- Fatal error if is selected 50 pictures
- Issue : Connection to assetsd was interrupted or assetsd died HOT 1
- IOS 9 - Deprecate HOT 6
- How to show gallery images in Chronological order?
- How to use Camera Button HOT 1
- how can we add This library to swift?.. by using cocopods?.
- when i open the ElcImagePicker selection is not visible ?. HOT 8
- ALAsset is deprecated. HOT 3
- Images are small on iPhone6/6+
- a bug
- When I choose eight pictures, then choose ninth, there will be no more than eight of the tips, and then the eighth cancel the choice, once again choose this situation will appear
- It crashes on Xcode8 & Swift 3.0. HOT 1
- SELECT ALL HOT 1
- how to implement ELCImagePickerController Delegate method in Swift 3.0?
- IOS 11 not show Button "Done" HOT 6
- how to open one special album or recent album?
- ELCImagePicker crash reported in Crashlytics. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elcimagepickercontroller.