Quantcast
Channel: Questions in topic: "ios"
Viewing all articles
Browse latest Browse all 4709

Video player app button touch input working on android not on ios

$
0
0
Creating several buttons on the bottom of a video app player with the following code. The touch input works on android and on macOS build, but touch input is ignored on iPhone ios. Please see the code below. The button width and height are fixed but the position is calculated based on the screen width=1920 and height=1080 The code is below for (int i = 0; i < mViewCount; i++) { GameObject lViewInstance = GameObject.Instantiate(mViewButtonTemplate); lViewInstance.name = "ViewButton " + i; Debug.Log ("Adding buttons"); RectTransform lViewTransform = lViewInstance.transform as RectTransform; lViewTransform.SetParent(mViewButtonTemplate.transform.parent); Image lViewImage = lViewTransform.GetChild(0).GetComponent(); lViewImage.rectTransform.sizeDelta = new Vector2(ViewButton.WIDTH, ViewButton.HEIGHT); if (!InvertVideo()) { lViewImage.rectTransform.rotation = Quaternion.AngleAxis(180f, lViewImage.rectTransform.right); } lViewTransform.localScale = Vector3.one; lViewTransform.anchoredPosition = lViewTemplateTransform.anchoredPosition; lViewTransform.anchorMin = lViewTemplateTransform.anchorMin; lViewTransform.anchorMax = lViewTemplateTransform.anchorMax; lViewTransform.offsetMin = lViewTemplateTransform.offsetMin; lViewTransform.offsetMax = lViewTemplateTransform.offsetMax; Vector3 lPosition = lViewTransform.localPosition; lPosition.x = lPosition.x + (i * (lViewTemplateTransform.rect.width + 10f)); lPosition.y = ((RectTransform)lViewTransform.parent).sizeDelta.y * 0.5f; lPosition.z = 0f; lViewTransform.localPosition = lPosition; ViewButton lViewButton = lViewInstance.GetComponent(); lViewButton.Index = i; lViewButton.Controller = this; lViewButton.UpdateMaterial(this, i); mViewButtons.Add(lViewButton); }

Viewing all articles
Browse latest Browse all 4709

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>