custom-view

What method of UIView gets called when instantiated from a NIB?

放肆的年华 提交于 2020-01-01 09:28:56
问题 I have a simple custom view that is connected via outlet to a NIB. For this particular view, there are actions that I would like to perform on the view when it is initialized, no matter what NIB it is on. Trouble is, neither the (id)init or the (id)initWithFrame:(CGRect)frame methods are getting called on the custom view. Which method gets called on a UIView when it is instantiated from a NIB? I would just use the view controller and viewDidLoad method except that this particular view appears

How to scroll “infinitely” wide view in Android?

天大地大妈咪最大 提交于 2019-12-30 03:37:09
问题 I am pondering the alternatives on how to scroll an "infinite", scale-like, control in android. The simple idea is to redraw the entire view on each scroll movement, but somehow it doesn't seem like the proper way. It is possible to draw the contents before-hand, but I have no clue how wide I should make the view in the first place, and what happens when the user scrolls to the end of the view? I guess I need to extend the view towards that direction. Should I go towards programatically

How do I create a custom view class Programmatically? [closed]

こ雲淡風輕ζ 提交于 2019-12-30 03:01:06
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 6 years ago . I want to create a very simple customView with a few UIlabel on it, How should i do this . any tutorial or suggestion would be appreciated . I am new to this , didn't try before. I tried this with xib. @interface MyCustomView : UIView @property (strong, nonatomic) IBOutlet UILabel

Views inside a custom ViewGroup not rendering after a size change

时光怂恿深爱的人放手 提交于 2019-12-30 00:28:28
问题 I'm running into a problem that has me stumped and I was hoping someone could give me some pointers. I'm working on an application that uses a custom ViewGroup (actually a FrameLayout that contains a RelativeLayout) to render an event calendar. The events inside the calendar are represented as views that are sized according to the duration of the event and the size of the containing view. I'm running into a problem that occurs when the containing FrameLayout is resized. The current

Camera with Custom View

自古美人都是妖i 提交于 2019-12-27 16:24:49
问题 My Application uses camera, I would like to add overlay over the camera preview. For example, I want to use a picture frame when I use Camera, also I would like to add a custom bar for camera operations. Kindly help me to do the same. 回答1: You might be trying using UIImagePickerController. But I know this one solution to your problem. You can do it easily using AVCamCaptureManager and AVCamRecorder classes. Apple has a demo program build on its developer site here. It is named AVCam. In

Camera with Custom View

丶灬走出姿态 提交于 2019-12-27 16:24:26
问题 My Application uses camera, I would like to add overlay over the camera preview. For example, I want to use a picture frame when I use Camera, also I would like to add a custom bar for camera operations. Kindly help me to do the same. 回答1: You might be trying using UIImagePickerController. But I know this one solution to your problem. You can do it easily using AVCamCaptureManager and AVCamRecorder classes. Apple has a demo program build on its developer site here. It is named AVCam. In

Add customview in navigation bar like whatsapp

醉酒当歌 提交于 2019-12-23 20:15:02
问题 I want to create custom navigation bar like WhatsApp uses to display call indicator in the application as given below. I have successfully added view like above but it's not responsive because I am not able to detect touch on status bar. I can touch only part below "Touch to return to call". Code is as given below. @property (nonatomic) UIView *navigationBarTopView; UIWindow *window = [UIApplication sharedApplication].keyWindow; if (_navigationBarTopView == nil) { _navigationBarTopView = [

Next view id as a custom attribute in android

不羁岁月 提交于 2019-12-23 10:06:43
问题 For my custom view I have also defined a custom attribute for keep id of the view. Its format is "reference". in layout xml it is defined like below, very similar with android:layout_below attr <mycustomview id="@+id/cv_1" xyz:nextviewId="@id/cv_2"... /> <mycustomview id="@+id/cv_2" xyz:nextviewId="@id/cv_3"... /> ... <LinearLayout ...> <mycustomview id="@+id/cv_3" xyz:nextviewId="@id/cv_4"... /> </LinearLayout> ... it gives me error I think it is because it is not declared yet. Any

How do I access layout_height from within my custom view?

邮差的信 提交于 2019-12-23 09:17:07
问题 I have a custom view and I simply wish to access the xml layout value of layout_height . I am presently getting that information and storing it during onMeasure, but that only happens when the view is first painted. My view is an XY plot and it needs to know its height as early as possible so it can start performing calculations. The view is on the fourth page of a viewFlipper layout, so the user may not flip to it for a while, but when they do flip to it, I would like the view to already

how to add views inside a custom View?

青春壹個敷衍的年華 提交于 2019-12-23 07:38:10
问题 I have a class like that, and there are about 10 of them public class DataItemPlainView extends View{ public DataItemPlainView(Context context) { super(context); // TODO Auto-generated constructor stub }} Now I need to put TextView, ImageView etc inside this view. And when I call it from somewhere, I want to get my customView. setting a view to a custom layout is a case too. Thanks 回答1: Your custom view needs to extend ViewGroup or one of the other classes that extends ViewGroup . For example