Segmented Control loading problem in Tab View
I am trying to implement a segmented control into a view controller like this picture
In first tab everything is ok but the second tab nothing is displayed
But I really don't know what is going on.
This is my code in switch between tabs:
@IBOutlet weak var NewsView: UIView!
@IBOutlet weak var VideoView: UIView!
@IBOutlet weak var Newspaper: UIView!
@IBAction func SwitchView(_ sender: UISegmentedControl) {
if sender.selectedSegmentIndex == 2{
NewsView.alpha = 1
VideoView.alpha = 0
Newspaper.alpha = 0
}else if sender.selectedSegmentIndex == 1{
VideoView.alpha = 1
NewsView.alpha = 0
Newspaper.alpha = 0
}else{
Newspaper.alpha = 1
NewsView.alpha = 0
VideoView.alpha = 0
}
}
ios swift segment
add a comment |
I am trying to implement a segmented control into a view controller like this picture
In first tab everything is ok but the second tab nothing is displayed
But I really don't know what is going on.
This is my code in switch between tabs:
@IBOutlet weak var NewsView: UIView!
@IBOutlet weak var VideoView: UIView!
@IBOutlet weak var Newspaper: UIView!
@IBAction func SwitchView(_ sender: UISegmentedControl) {
if sender.selectedSegmentIndex == 2{
NewsView.alpha = 1
VideoView.alpha = 0
Newspaper.alpha = 0
}else if sender.selectedSegmentIndex == 1{
VideoView.alpha = 1
NewsView.alpha = 0
Newspaper.alpha = 0
}else{
Newspaper.alpha = 1
NewsView.alpha = 0
VideoView.alpha = 0
}
}
ios swift segment
Can you check that wether your views are being hidden from storyboard or not?
– Syed Qamar Abbas
Nov 26 '18 at 9:55
Can you check your view is not blank and proper getter/setting is applied for different uielements.
– Basir Alam
Nov 26 '18 at 11:21
Share your table view delegate and data source code.
– T. Pasichnyk
Nov 26 '18 at 12:26
add a comment |
I am trying to implement a segmented control into a view controller like this picture
In first tab everything is ok but the second tab nothing is displayed
But I really don't know what is going on.
This is my code in switch between tabs:
@IBOutlet weak var NewsView: UIView!
@IBOutlet weak var VideoView: UIView!
@IBOutlet weak var Newspaper: UIView!
@IBAction func SwitchView(_ sender: UISegmentedControl) {
if sender.selectedSegmentIndex == 2{
NewsView.alpha = 1
VideoView.alpha = 0
Newspaper.alpha = 0
}else if sender.selectedSegmentIndex == 1{
VideoView.alpha = 1
NewsView.alpha = 0
Newspaper.alpha = 0
}else{
Newspaper.alpha = 1
NewsView.alpha = 0
VideoView.alpha = 0
}
}
ios swift segment
I am trying to implement a segmented control into a view controller like this picture
In first tab everything is ok but the second tab nothing is displayed
But I really don't know what is going on.
This is my code in switch between tabs:
@IBOutlet weak var NewsView: UIView!
@IBOutlet weak var VideoView: UIView!
@IBOutlet weak var Newspaper: UIView!
@IBAction func SwitchView(_ sender: UISegmentedControl) {
if sender.selectedSegmentIndex == 2{
NewsView.alpha = 1
VideoView.alpha = 0
Newspaper.alpha = 0
}else if sender.selectedSegmentIndex == 1{
VideoView.alpha = 1
NewsView.alpha = 0
Newspaper.alpha = 0
}else{
Newspaper.alpha = 1
NewsView.alpha = 0
VideoView.alpha = 0
}
}
ios swift segment
ios swift segment
edited Nov 26 '18 at 15:57
rmaddy
242k27316380
242k27316380
asked Nov 26 '18 at 9:43
ali fallahali fallah
353210
353210
Can you check that wether your views are being hidden from storyboard or not?
– Syed Qamar Abbas
Nov 26 '18 at 9:55
Can you check your view is not blank and proper getter/setting is applied for different uielements.
– Basir Alam
Nov 26 '18 at 11:21
Share your table view delegate and data source code.
– T. Pasichnyk
Nov 26 '18 at 12:26
add a comment |
Can you check that wether your views are being hidden from storyboard or not?
– Syed Qamar Abbas
Nov 26 '18 at 9:55
Can you check your view is not blank and proper getter/setting is applied for different uielements.
– Basir Alam
Nov 26 '18 at 11:21
Share your table view delegate and data source code.
– T. Pasichnyk
Nov 26 '18 at 12:26
Can you check that wether your views are being hidden from storyboard or not?
– Syed Qamar Abbas
Nov 26 '18 at 9:55
Can you check that wether your views are being hidden from storyboard or not?
– Syed Qamar Abbas
Nov 26 '18 at 9:55
Can you check your view is not blank and proper getter/setting is applied for different uielements.
– Basir Alam
Nov 26 '18 at 11:21
Can you check your view is not blank and proper getter/setting is applied for different uielements.
– Basir Alam
Nov 26 '18 at 11:21
Share your table view delegate and data source code.
– T. Pasichnyk
Nov 26 '18 at 12:26
Share your table view delegate and data source code.
– T. Pasichnyk
Nov 26 '18 at 12:26
add a comment |
1 Answer
1
active
oldest
votes
UISegmentedControl.selectedSegmentIndex start with 0, so have you implemented your cases in SwitchView() according to it?
Why are you changing alpha value of views, you should hide and unhide the views. If your data are displaying on tableView then change data and reload tableView then no need to add multiple views.
You can debug your if-else conditions using breakpoints.
Why my answer gets a downvote? please explain the reason.
– iDev750
Nov 26 '18 at 10:50
I don't see the reason to downvote this answer. The questions are reasonable. But you should have asked this questions as a comments to main post, because it is not answering anything.
– T. Pasichnyk
Nov 26 '18 at 12:28
@T.Pasichnyk Thank you for your suggestion !!
– iDev750
Nov 26 '18 at 12:43
add a comment |
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%2f53478334%2fsegmented-control-loading-problem-in-tab-view%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
UISegmentedControl.selectedSegmentIndex start with 0, so have you implemented your cases in SwitchView() according to it?
Why are you changing alpha value of views, you should hide and unhide the views. If your data are displaying on tableView then change data and reload tableView then no need to add multiple views.
You can debug your if-else conditions using breakpoints.
Why my answer gets a downvote? please explain the reason.
– iDev750
Nov 26 '18 at 10:50
I don't see the reason to downvote this answer. The questions are reasonable. But you should have asked this questions as a comments to main post, because it is not answering anything.
– T. Pasichnyk
Nov 26 '18 at 12:28
@T.Pasichnyk Thank you for your suggestion !!
– iDev750
Nov 26 '18 at 12:43
add a comment |
UISegmentedControl.selectedSegmentIndex start with 0, so have you implemented your cases in SwitchView() according to it?
Why are you changing alpha value of views, you should hide and unhide the views. If your data are displaying on tableView then change data and reload tableView then no need to add multiple views.
You can debug your if-else conditions using breakpoints.
Why my answer gets a downvote? please explain the reason.
– iDev750
Nov 26 '18 at 10:50
I don't see the reason to downvote this answer. The questions are reasonable. But you should have asked this questions as a comments to main post, because it is not answering anything.
– T. Pasichnyk
Nov 26 '18 at 12:28
@T.Pasichnyk Thank you for your suggestion !!
– iDev750
Nov 26 '18 at 12:43
add a comment |
UISegmentedControl.selectedSegmentIndex start with 0, so have you implemented your cases in SwitchView() according to it?
Why are you changing alpha value of views, you should hide and unhide the views. If your data are displaying on tableView then change data and reload tableView then no need to add multiple views.
You can debug your if-else conditions using breakpoints.
UISegmentedControl.selectedSegmentIndex start with 0, so have you implemented your cases in SwitchView() according to it?
Why are you changing alpha value of views, you should hide and unhide the views. If your data are displaying on tableView then change data and reload tableView then no need to add multiple views.
You can debug your if-else conditions using breakpoints.
answered Nov 26 '18 at 9:52
iDev750iDev750
5981315
5981315
Why my answer gets a downvote? please explain the reason.
– iDev750
Nov 26 '18 at 10:50
I don't see the reason to downvote this answer. The questions are reasonable. But you should have asked this questions as a comments to main post, because it is not answering anything.
– T. Pasichnyk
Nov 26 '18 at 12:28
@T.Pasichnyk Thank you for your suggestion !!
– iDev750
Nov 26 '18 at 12:43
add a comment |
Why my answer gets a downvote? please explain the reason.
– iDev750
Nov 26 '18 at 10:50
I don't see the reason to downvote this answer. The questions are reasonable. But you should have asked this questions as a comments to main post, because it is not answering anything.
– T. Pasichnyk
Nov 26 '18 at 12:28
@T.Pasichnyk Thank you for your suggestion !!
– iDev750
Nov 26 '18 at 12:43
Why my answer gets a downvote? please explain the reason.
– iDev750
Nov 26 '18 at 10:50
Why my answer gets a downvote? please explain the reason.
– iDev750
Nov 26 '18 at 10:50
I don't see the reason to downvote this answer. The questions are reasonable. But you should have asked this questions as a comments to main post, because it is not answering anything.
– T. Pasichnyk
Nov 26 '18 at 12:28
I don't see the reason to downvote this answer. The questions are reasonable. But you should have asked this questions as a comments to main post, because it is not answering anything.
– T. Pasichnyk
Nov 26 '18 at 12:28
@T.Pasichnyk Thank you for your suggestion !!
– iDev750
Nov 26 '18 at 12:43
@T.Pasichnyk Thank you for your suggestion !!
– iDev750
Nov 26 '18 at 12:43
add a comment |
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.
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%2f53478334%2fsegmented-control-loading-problem-in-tab-view%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
Can you check that wether your views are being hidden from storyboard or not?
– Syed Qamar Abbas
Nov 26 '18 at 9:55
Can you check your view is not blank and proper getter/setting is applied for different uielements.
– Basir Alam
Nov 26 '18 at 11:21
Share your table view delegate and data source code.
– T. Pasichnyk
Nov 26 '18 at 12:26