- Home /
Cells for a mobile app stacked vertically, not moving correctly
Hi,
I have a mobile app I'm trying to make with many cells that look like the attached picture
My main problem is the function I'm including at the end of this question. That function expands or collapses the cell with an animation (which just increases or decreases the entire cells Size.Delta.y) And moves all the cells up or down so no cells are ever inside another or so that there is no extra space between the cells. This code does all this fine enough but if you tap any of the cells fast enough they at best will sometimes have the cell collapse but the text won't be hidden so it's just inside the cell, in the attached picture for example that would be an expanded cell, so the gambling line an everything below it would be inside the cells main area overlapping with the location and times. And at worst the cells will be partially overlapping with other cells. Very noticeably overlapping, not just a little off. Or they jump up or down and leave some empty space where the cell used to be.
Also one last bug I can't find anywhere is when I launch the app on my phone at the black screen before it loads and even at the unity splash (I don't have unity pro yet) if I tap the screen before I can even see the cells during the unity splash or black screen it seems to still interact with the buttons and the entire program seems to glitch out in various ways.. Is there a way to lock any input to the screen until After the cells are all loaded up and the initializing scripts are done? Like accept no input until the first frame of the app is loaded, after the unity splash.
Thanks in advance for any help.
This is being called as a Coroutine and being passed the cell that was tapped on
public IEnumerator DropDownCell(GameObject CurrentCell) {
#region Assign Variables
CurrentCell.GetComponent<CSVLoad>().bDropDown = CurrentCell.GetComponent<Button>();
foreach (Button button in CurrentCell.GetComponentsInChildren<Button>())
{
if (button.name == "Phone Number")
{
CurrentCell.GetComponent<CSVLoad>().bPhoneNum = button;
}
else if (button.name == "Location Address")
{
CurrentCell.GetComponent<CSVLoad>().bLocation = button;
}
}
float CurrCellY = CurrentCell.GetComponent<RectTransform>().anchoredPosition.y;
float CurrCellHeight = CurrentCell.GetComponent<RectTransform>().sizeDelta.y;
#endregion
if (!CurrentCell.GetComponent<CSVLoad>().flag)
{
CurrentCell.GetComponent<Animator>().Play("CellExpand");
CurrentCell.GetComponent<CSVLoad>().flag = true;
CurrentCell.GetComponent<CSVLoad>().Expanded = true;
yield return new WaitForSeconds(.15f);
CurrentCell.GetComponent<CSVLoad>().ExpandedCell.SetActive(true);
CurrentCell.GetComponent<CSVLoad>().bPhoneNum.interactable = true;
foreach (GameObject Cell in CellList)
{
float cellY = Cell.GetComponent<RectTransform>().anchoredPosition.y;
float cellHeight = Cell.GetComponent<RectTransform>().sizeDelta.y;
if (cellY < CurrCellY)
{
Cell.GetComponent<RectTransform>().anchoredPosition
= new Vector2(Cell.GetComponent<RectTransform>().anchoredPosition.x,
cellY -= 203f);
}
}
}
else if (CurrentCell.GetComponent<CSVLoad>().flag)
{
CurrentCell.GetComponent<Animator>().Play("CellCollapse");
CurrentCell.GetComponent<CSVLoad>().flag = false;
CurrentCell.GetComponent<CSVLoad>().Expanded = false;
yield return new WaitForSeconds(.01f);
CurrentCell.GetComponent<CSVLoad>().ExpandedCell.SetActive(false);
foreach (GameObject Cell in CellList)
{
float cellY = Cell.GetComponent<RectTransform>().anchoredPosition.y;
float cellHeight = Cell.GetComponent<RectTransform>().sizeDelta.y;
CurrentCell.GetComponent<CSVLoad>().bPhoneNum.interactable = false;
if (cellY < CurrCellY)
{
Cell.GetComponent<RectTransform>().anchoredPosition
= new Vector2(Cell.GetComponent<RectTransform>().anchoredPosition.x,
cellY += 203f);
}
}
}
yield return null;
}
Your answer
Follow this Question
Related Questions
Mecanim for Mobile Devices 2 Answers
Vertical mobile input 0 Answers
Using the Volume Control Buttons On Mobile Devices 0 Answers
Video player app button touch input working on android not on ios 0 Answers