Highlight a region in an image if user touches it
for example we have an image with 4 regions. It is a still image (UIImage).
The image background is transparent and the regions are marked out with the black color. The regions have different forms, colours and positions.
if user touches the region 2 - it is highlighted, if user touches the region 4 - it is also highlighted.
I want to detect if user touches a region and then highlight it inside with its own colour.
Can someone please explain how can I achieve this in swift?
swift xcode image highlight
|
show 2 more comments
for example we have an image with 4 regions. It is a still image (UIImage).
The image background is transparent and the regions are marked out with the black color. The regions have different forms, colours and positions.
if user touches the region 2 - it is highlighted, if user touches the region 4 - it is also highlighted.
I want to detect if user touches a region and then highlight it inside with its own colour.
Can someone please explain how can I achieve this in swift?
swift xcode image highlight
region image is blank? can you please explain and show proper UI what you want?
– Abhishek Jadhav
yesterday
Add tap gestures in your views and maintain indexes for selected and unselected views when tap gesture is tapped.
– prekshya basnet
yesterday
Cut the image in 4 parts and make 4 buttons.
– Casper Zandbergen
yesterday
@CasperZandbergen the regions may have different forms and positions, they are not hard-coded
– Paul
yesterday
You have to provide the regions with each image then, then check for touch up inside that region.
– Casper Zandbergen
yesterday
|
show 2 more comments
for example we have an image with 4 regions. It is a still image (UIImage).
The image background is transparent and the regions are marked out with the black color. The regions have different forms, colours and positions.
if user touches the region 2 - it is highlighted, if user touches the region 4 - it is also highlighted.
I want to detect if user touches a region and then highlight it inside with its own colour.
Can someone please explain how can I achieve this in swift?
swift xcode image highlight
for example we have an image with 4 regions. It is a still image (UIImage).
The image background is transparent and the regions are marked out with the black color. The regions have different forms, colours and positions.
if user touches the region 2 - it is highlighted, if user touches the region 4 - it is also highlighted.
I want to detect if user touches a region and then highlight it inside with its own colour.
Can someone please explain how can I achieve this in swift?
swift xcode image highlight
swift xcode image highlight
edited yesterday
Moritz
57.4k19131184
57.4k19131184
asked yesterday
Paul
13
13
region image is blank? can you please explain and show proper UI what you want?
– Abhishek Jadhav
yesterday
Add tap gestures in your views and maintain indexes for selected and unselected views when tap gesture is tapped.
– prekshya basnet
yesterday
Cut the image in 4 parts and make 4 buttons.
– Casper Zandbergen
yesterday
@CasperZandbergen the regions may have different forms and positions, they are not hard-coded
– Paul
yesterday
You have to provide the regions with each image then, then check for touch up inside that region.
– Casper Zandbergen
yesterday
|
show 2 more comments
region image is blank? can you please explain and show proper UI what you want?
– Abhishek Jadhav
yesterday
Add tap gestures in your views and maintain indexes for selected and unselected views when tap gesture is tapped.
– prekshya basnet
yesterday
Cut the image in 4 parts and make 4 buttons.
– Casper Zandbergen
yesterday
@CasperZandbergen the regions may have different forms and positions, they are not hard-coded
– Paul
yesterday
You have to provide the regions with each image then, then check for touch up inside that region.
– Casper Zandbergen
yesterday
region image is blank? can you please explain and show proper UI what you want?
– Abhishek Jadhav
yesterday
region image is blank? can you please explain and show proper UI what you want?
– Abhishek Jadhav
yesterday
Add tap gestures in your views and maintain indexes for selected and unselected views when tap gesture is tapped.
– prekshya basnet
yesterday
Add tap gestures in your views and maintain indexes for selected and unselected views when tap gesture is tapped.
– prekshya basnet
yesterday
Cut the image in 4 parts and make 4 buttons.
– Casper Zandbergen
yesterday
Cut the image in 4 parts and make 4 buttons.
– Casper Zandbergen
yesterday
@CasperZandbergen the regions may have different forms and positions, they are not hard-coded
– Paul
yesterday
@CasperZandbergen the regions may have different forms and positions, they are not hard-coded
– Paul
yesterday
You have to provide the regions with each image then, then check for touch up inside that region.
– Casper Zandbergen
yesterday
You have to provide the regions with each image then, then check for touch up inside that region.
– Casper Zandbergen
yesterday
|
show 2 more comments
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',
autoActivateHeartbeat: false,
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944278%2fhighlight-a-region-in-an-image-if-user-touches-it%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53944278%2fhighlight-a-region-in-an-image-if-user-touches-it%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
region image is blank? can you please explain and show proper UI what you want?
– Abhishek Jadhav
yesterday
Add tap gestures in your views and maintain indexes for selected and unselected views when tap gesture is tapped.
– prekshya basnet
yesterday
Cut the image in 4 parts and make 4 buttons.
– Casper Zandbergen
yesterday
@CasperZandbergen the regions may have different forms and positions, they are not hard-coded
– Paul
yesterday
You have to provide the regions with each image then, then check for touch up inside that region.
– Casper Zandbergen
yesterday