Any interaction with the screen locks animation











up vote
0
down vote

favorite












I have a UIView that sets a timer and each firing it generates a UIImage on a background queue (priority .userInitiated), and when finished (measured to take between 1-2 milliseconds, it pushes to the main queue and updates a UIImageView's image.



This creates a smooth animation effect (e.g. if the Timer is configured to fire 30 times per second). Touching the screen however either slows down or completely shuts down the updating. I removed my overrides of touchesBegan,Moved,Ended and any GestureRecognizers to ensure that I wasn't doing anything expensive. Simply touching the screen (especially dragging quickly) prevents the UI updating.



I watched this and googled as many SO posts as I can but I'm completely stuck on this.



Here is a reproduction of the problem. Run the app and it will display a stripped down rendering of a basic project. From there, you can drag/touch the screen and notice the frames will either slow down to a crawl or completely stop.



Github Repro










share|improve this question
























  • Personally I'd use a CADisplayLink, but you need to configure it so it's not affected by scrolling
    – MadProgrammer
    Nov 5 at 3:50










  • sure, but i'm still running the intensive processing on a background queue and simply updating the UIImageView's image on the main queue. apple even suggests one can use both a Timer and a DisplayLink to do real time animating like this. I'll try substitution a DisplayLink but using a Timer specifically should not be the bottleneck.
    – Alex Bollbach
    Nov 5 at 3:56










  • As I understand it, both (by default) CADisplayLink and Timer run on the main runLoop, so any UI interaction could "stall" them - I might be over simplifying this though
    – MadProgrammer
    Nov 5 at 3:58










  • well, something relevant here is that I added a print statement in the line that pushes to the main queue and updates the UIImageView. when i start dragging, its stilled fired. So the Timer keeps firing, the processing is succeeding while I'm dragging, I just don't see the results. So the problem appears to be "downstream" of the timer firing and rendering.
    – Alex Bollbach
    Nov 5 at 4:00










  • Possibly because the "paint" cycles are suspended? I was told in passing about Timer running on the main run loop and how would be affected by scrolling :/
    – MadProgrammer
    Nov 5 at 4:02

















up vote
0
down vote

favorite












I have a UIView that sets a timer and each firing it generates a UIImage on a background queue (priority .userInitiated), and when finished (measured to take between 1-2 milliseconds, it pushes to the main queue and updates a UIImageView's image.



This creates a smooth animation effect (e.g. if the Timer is configured to fire 30 times per second). Touching the screen however either slows down or completely shuts down the updating. I removed my overrides of touchesBegan,Moved,Ended and any GestureRecognizers to ensure that I wasn't doing anything expensive. Simply touching the screen (especially dragging quickly) prevents the UI updating.



I watched this and googled as many SO posts as I can but I'm completely stuck on this.



Here is a reproduction of the problem. Run the app and it will display a stripped down rendering of a basic project. From there, you can drag/touch the screen and notice the frames will either slow down to a crawl or completely stop.



Github Repro










share|improve this question
























  • Personally I'd use a CADisplayLink, but you need to configure it so it's not affected by scrolling
    – MadProgrammer
    Nov 5 at 3:50










  • sure, but i'm still running the intensive processing on a background queue and simply updating the UIImageView's image on the main queue. apple even suggests one can use both a Timer and a DisplayLink to do real time animating like this. I'll try substitution a DisplayLink but using a Timer specifically should not be the bottleneck.
    – Alex Bollbach
    Nov 5 at 3:56










  • As I understand it, both (by default) CADisplayLink and Timer run on the main runLoop, so any UI interaction could "stall" them - I might be over simplifying this though
    – MadProgrammer
    Nov 5 at 3:58










  • well, something relevant here is that I added a print statement in the line that pushes to the main queue and updates the UIImageView. when i start dragging, its stilled fired. So the Timer keeps firing, the processing is succeeding while I'm dragging, I just don't see the results. So the problem appears to be "downstream" of the timer firing and rendering.
    – Alex Bollbach
    Nov 5 at 4:00










  • Possibly because the "paint" cycles are suspended? I was told in passing about Timer running on the main run loop and how would be affected by scrolling :/
    – MadProgrammer
    Nov 5 at 4:02















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a UIView that sets a timer and each firing it generates a UIImage on a background queue (priority .userInitiated), and when finished (measured to take between 1-2 milliseconds, it pushes to the main queue and updates a UIImageView's image.



This creates a smooth animation effect (e.g. if the Timer is configured to fire 30 times per second). Touching the screen however either slows down or completely shuts down the updating. I removed my overrides of touchesBegan,Moved,Ended and any GestureRecognizers to ensure that I wasn't doing anything expensive. Simply touching the screen (especially dragging quickly) prevents the UI updating.



I watched this and googled as many SO posts as I can but I'm completely stuck on this.



Here is a reproduction of the problem. Run the app and it will display a stripped down rendering of a basic project. From there, you can drag/touch the screen and notice the frames will either slow down to a crawl or completely stop.



Github Repro










share|improve this question















I have a UIView that sets a timer and each firing it generates a UIImage on a background queue (priority .userInitiated), and when finished (measured to take between 1-2 milliseconds, it pushes to the main queue and updates a UIImageView's image.



This creates a smooth animation effect (e.g. if the Timer is configured to fire 30 times per second). Touching the screen however either slows down or completely shuts down the updating. I removed my overrides of touchesBegan,Moved,Ended and any GestureRecognizers to ensure that I wasn't doing anything expensive. Simply touching the screen (especially dragging quickly) prevents the UI updating.



I watched this and googled as many SO posts as I can but I'm completely stuck on this.



Here is a reproduction of the problem. Run the app and it will display a stripped down rendering of a basic project. From there, you can drag/touch the screen and notice the frames will either slow down to a crawl or completely stop.



Github Repro







ios uiimageview core-graphics






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 5 at 6:38

























asked Nov 5 at 3:48









Alex Bollbach

1,305736




1,305736












  • Personally I'd use a CADisplayLink, but you need to configure it so it's not affected by scrolling
    – MadProgrammer
    Nov 5 at 3:50










  • sure, but i'm still running the intensive processing on a background queue and simply updating the UIImageView's image on the main queue. apple even suggests one can use both a Timer and a DisplayLink to do real time animating like this. I'll try substitution a DisplayLink but using a Timer specifically should not be the bottleneck.
    – Alex Bollbach
    Nov 5 at 3:56










  • As I understand it, both (by default) CADisplayLink and Timer run on the main runLoop, so any UI interaction could "stall" them - I might be over simplifying this though
    – MadProgrammer
    Nov 5 at 3:58










  • well, something relevant here is that I added a print statement in the line that pushes to the main queue and updates the UIImageView. when i start dragging, its stilled fired. So the Timer keeps firing, the processing is succeeding while I'm dragging, I just don't see the results. So the problem appears to be "downstream" of the timer firing and rendering.
    – Alex Bollbach
    Nov 5 at 4:00










  • Possibly because the "paint" cycles are suspended? I was told in passing about Timer running on the main run loop and how would be affected by scrolling :/
    – MadProgrammer
    Nov 5 at 4:02




















  • Personally I'd use a CADisplayLink, but you need to configure it so it's not affected by scrolling
    – MadProgrammer
    Nov 5 at 3:50










  • sure, but i'm still running the intensive processing on a background queue and simply updating the UIImageView's image on the main queue. apple even suggests one can use both a Timer and a DisplayLink to do real time animating like this. I'll try substitution a DisplayLink but using a Timer specifically should not be the bottleneck.
    – Alex Bollbach
    Nov 5 at 3:56










  • As I understand it, both (by default) CADisplayLink and Timer run on the main runLoop, so any UI interaction could "stall" them - I might be over simplifying this though
    – MadProgrammer
    Nov 5 at 3:58










  • well, something relevant here is that I added a print statement in the line that pushes to the main queue and updates the UIImageView. when i start dragging, its stilled fired. So the Timer keeps firing, the processing is succeeding while I'm dragging, I just don't see the results. So the problem appears to be "downstream" of the timer firing and rendering.
    – Alex Bollbach
    Nov 5 at 4:00










  • Possibly because the "paint" cycles are suspended? I was told in passing about Timer running on the main run loop and how would be affected by scrolling :/
    – MadProgrammer
    Nov 5 at 4:02


















Personally I'd use a CADisplayLink, but you need to configure it so it's not affected by scrolling
– MadProgrammer
Nov 5 at 3:50




Personally I'd use a CADisplayLink, but you need to configure it so it's not affected by scrolling
– MadProgrammer
Nov 5 at 3:50












sure, but i'm still running the intensive processing on a background queue and simply updating the UIImageView's image on the main queue. apple even suggests one can use both a Timer and a DisplayLink to do real time animating like this. I'll try substitution a DisplayLink but using a Timer specifically should not be the bottleneck.
– Alex Bollbach
Nov 5 at 3:56




sure, but i'm still running the intensive processing on a background queue and simply updating the UIImageView's image on the main queue. apple even suggests one can use both a Timer and a DisplayLink to do real time animating like this. I'll try substitution a DisplayLink but using a Timer specifically should not be the bottleneck.
– Alex Bollbach
Nov 5 at 3:56












As I understand it, both (by default) CADisplayLink and Timer run on the main runLoop, so any UI interaction could "stall" them - I might be over simplifying this though
– MadProgrammer
Nov 5 at 3:58




As I understand it, both (by default) CADisplayLink and Timer run on the main runLoop, so any UI interaction could "stall" them - I might be over simplifying this though
– MadProgrammer
Nov 5 at 3:58












well, something relevant here is that I added a print statement in the line that pushes to the main queue and updates the UIImageView. when i start dragging, its stilled fired. So the Timer keeps firing, the processing is succeeding while I'm dragging, I just don't see the results. So the problem appears to be "downstream" of the timer firing and rendering.
– Alex Bollbach
Nov 5 at 4:00




well, something relevant here is that I added a print statement in the line that pushes to the main queue and updates the UIImageView. when i start dragging, its stilled fired. So the Timer keeps firing, the processing is succeeding while I'm dragging, I just don't see the results. So the problem appears to be "downstream" of the timer firing and rendering.
– Alex Bollbach
Nov 5 at 4:00












Possibly because the "paint" cycles are suspended? I was told in passing about Timer running on the main run loop and how would be affected by scrolling :/
– MadProgrammer
Nov 5 at 4:02






Possibly because the "paint" cycles are suspended? I was told in passing about Timer running on the main run loop and how would be affected by scrolling :/
– MadProgrammer
Nov 5 at 4:02



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53148062%2fany-interaction-with-the-screen-locks-animation%23new-answer', 'question_page');
}
);

Post as a guest





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53148062%2fany-interaction-with-the-screen-locks-animation%23new-answer', 'question_page');
}
);

Post as a guest




















































































這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()