Detailed Description
In order to make the technical problems solved by the present invention, the technical solutions adopted and the technical effects achieved more clear, the technical solutions of the embodiments of the present invention will be described in further detail below with reference to the accompanying drawings, and it is obvious that the described embodiments are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention. In the following embodiments, optional features and examples are provided in each embodiment at the same time, and the features described in the embodiments may be combined to form multiple alternatives, and each numbered embodiment should not be considered as only one technical solution.
Example 1
Fig. 1 is a schematic flow chart of a queuing playback method of a view according to a first embodiment of the present invention. The queuing and playing method of the views disclosed in the embodiment can be applied to the case of queuing and playing the views, for example, the case of queuing and playing the banner views of gifts. The queuing playback method of the view disclosed in the embodiment may be performed by a queuing playback apparatus of the view (may be simply referred to as a queuing playback apparatus), where the apparatus may be implemented by hardware and/or hardware, and may be configured in an electronic device, for example, an electronic device such as a smart phone, a computer, or the like.
Referring to fig. 1, the queuing playing method of the view comprises the following steps:
s110, acquiring first view model information from a preset array through a first view display method, and judging whether a target view model corresponding to the acquired current view model information exists or not.
In the embodiment of the present disclosure, the method names of the head-view display method may include, but are not limited to, [ self showFirstMsg ], and may be considered to be implemented inside the head-view display method from "acquire head-view model information" in step S110 until step S140 ends.
Wherein, the first view model information can be obtained by the following statement:
id<DYWBViewModelProtocal>msg=[_msgArray firstObject];
wherein, the name of the preset array can include, but is not limited to, _msgArray; at least one piece of view model information msg can be added in the preset array, and the view model information msg added first can be acquired first; wherein, through [ _ msgArray firstObject ] function, the first view model information msg in the preset array can be taken, and the view model information can be used for view construction and configuration; wherein DYWBViewModelProtocal may be used to characterize the protocol to be followed for building a view, which corresponds to assigning a header file to a view.
After the view model information is acquired, whether a target view model corresponding to the acquired current view model information exists or not can be judged through an if () statement. And, when the feedback result of the if () statement is 1, it can be considered that the corresponding target view model exists, and the step S120 can be continuously executed; when the feedback result of the if () statement is 0, the corresponding target view model may be considered to be absent, and at this time, the current view model information may be directly removed from the preset array, and the next first view model information may be obtained. When the corresponding target view model does not exist, view model information error prompt can be performed, so that user experience is improved.
In some optional implementations, before acquiring the first view model information from the preset array through the first view display method, the method further includes: and defining a view creation protocol, and declaring a view creation method corresponding to each display direction through the view creation protocol.
Wherein the view creation protocol may be defined by the following statement:
@protocol DYWBViewModelProtocal<NSObject>;
wherein @ protocol may be used to characterize a view creation protocol that is currently to be declared; wherein the view creation protocol is a common protocol for creating views, the name of which may include, but is not limited to, DYWBViewModelProtocal; wherein the view creation protocol may follow a base protocol NSObject, which may be considered the most fundamental class, typically each new protocol needs to follow the NSObject protocol.
The view creation protocol may include multiple view creation methods, for example, different view creation methods may be defined according to the display direction of the view, and different view creation methods may be defined according to the type and the display direction of the view. The display direction of the view can be a horizontal screen direction and a vertical screen direction. Types of views may include, but are not limited to, a Banner (Banner) view and an interactive control (e.g., snackbar) view, among others. In some alternative embodiments, when the type of view includes a banner view, the view that is queued for playing may be a gift banner view, thereby enabling queued playing of the gift banner view in the live APP.
By way of example, a view creation protocol may include a banner view creation method for a portrait screen and a banner view creation method for a landscape screen. The name of the banner view creation method of the vertical screen may include, but is not limited to, (uiiview < DYWBViewProtocol >) createbview;
the function of the related function code is to create a banner view of a vertical screen;
the description of the correlation function code is (uiiview < dywbview protocol >) which is a uiiview type return value, which is the protocol type dywbview protocol to which the return value is to be adhered. DYWBViewProtocol is a custom protocol type that resembles a header file, createBViewInView is a method of creating a banner view, and this function requires a parameter that is (UIView x) view, which represents the parent component of the created view.
The name of the banner view creation method of the banner screen may include, but is not limited to, (UIView < DYWBViewProtocol >) createbview, wherein the banner view of the banner screen may be a view displayed on the right side;
the function of the related function code is to create a banner view of a banner screen;
the description of the correlation function code is (uiiview < DYWBViewProtocol >) which is a uiiview type return value. The protocol type DYWBViewProtocol, DYWBViewProtocol to which the return value is to be adhered is custom, which resembles a header file, createBViewRighStyleInView is the method of creating a landscape banner view, and the function requires a parameter, which is (uiiview x) view, which represents the parent component of the created view.
In these alternative embodiments, by predefining the view creation protocol and declaring multiple view creation methods, unified creation logic for various views based on the view creation protocol is facilitated, thereby facilitating view creation and queuing playback logic.
In some further embodiments, after defining the view creation protocol, comprising: defining a view customization interface, and setting the view customization interface to comply with a view creation protocol; and customizing the graphic and text information of each view model by calling the view customization interface.
In order to meet the personalized requirements of users for customizing various different view models, a view customizing interface can be predefined, so that specific customization of image-text information such as images, identifications, characters and prompt information corresponding to each view model is realized through the view customizing interface.
Wherein the view customization interface may be set up to adhere to the view creation protocol by:
@interface DYNobleWBView:UIView<CAAnimationDelegate,DYWBViewProtocol>;
wherein @ interface can be used to characterize a view customization interface that is currently to be declared; wherein the name of the view customization interface may include, but is not limited to, DYNobleWBView; the view customization interface can follow an attribute animation protocol CAAnimationDelegate to realize animation agent on the view; the view customization interface may also follow a view creation protocol dywbview protocol, so that each customized view model may conform to dywbview protocol.
In these further embodiments, the construction of heterogeneous views is facilitated by tailoring the various view models to follow the view creation protocol, in accordance with unified creation logic.
In some optional embodiments, before acquiring the first view model information from the preset array through the first view display method, the method further includes: and defining a preset array through an array definition statement.
Wherein, the preset array can be defined by the following statement:
@property(nonatomic,strong,nonnull)NSMutableArray*msgArray;
wherein @ property can be used to characterize that a preset array is currently to be declared; wherein the name of the preset array may include, but is not limited to, msgArray; the NSMutableArray can be used for representing class names of classes to which a preset array belongs; wherein nonotomic, strong and nonnull are keywords for modifying the preset array.
In these alternative embodiments, by defining a preset array, view model information corresponding to a view to be displayed later can be stored.
In some further embodiments, after defining the preset array, further comprising: and calling a view information adding method, and adding view model information of the view to be played into a preset array.
After defining the preset array, a method for displaying the internal storage view of the preset array can be defined for the preset array, and the display method can be defined by the following statement:
-(void)showEnterMsg:(id<DYWBViewModelProtocal>)msg;
wherein the name of the presentation method may include, but is not limited to, showEnterMsg; the parameter variable of the parameter of the presentation method is (id < dywbview model process >) msg, and the name of the parameter variable may be view model information msg, and the parameter variable needs to follow the view creation protocol dywbview model process.
The first view display method disclosed in this embodiment may be a function belonging to the display method. In addition, the display method can further comprise a view information adding method [ self msgArray addObject: msg ], wherein the view adding method is a native array adding method of the IOS, and view model information of a view to be played can be added into a preset array before or while queuing to play the view.
And S120, if so, determining the screen display direction of the target view model, and judging whether the target view model complies with a view creation method corresponding to the screen display direction.
In this embodiment, if the view model corresponding to the target view model information exists, whether the view corresponding to the target view model needs to be displayed on the horizontal screen or not may be determined by an if (if right) statement. When the feedback result of if (if right) statement is 1, the view can be considered to need to be displayed by a transverse screen, and whether the target view model complies with the creation method corresponding to the transverse screen view can be continuously judged; when the feedback result of if (if right) statement is 0, the view can be considered to need to be displayed by the vertical screen, and whether the target view model complies with the creation method corresponding to the vertical screen view can be continuously judged.
Wherein, if ([ msg respondsToSelector: @ selector () ]) statements may be employed to make a determination as to whether the corresponding creation method is complied with. Illustratively, when the target view model is a banner view, whether the target view model msg is in compliance with the method of creating a banner view may be determined by an if ([ msg respondsToSelector @ selector (createbviewrightstyleinview:) ]) judgment statement; whether the target view model msg image complies with the vertical screen view creation method can be judged by an if ([ msg respondsToSelector @ selector (createBView:) ]).
S130, if the target view model complies with the view creation method corresponding to the screen display direction, the view creation method is called to create the view to be played currently, the view to be played currently is configured according to the parameters of the target view model, and the configured view is played.
In this embodiment, if the target view model complies with the view creation method corresponding to the screen display direction, the view to be played currently may be created by bview= [ msg×: self ] statement, where××may represent the view creation method corresponding to the screen display direction, and exemplary may be the creation method of a transverse screen view, or may be the creation method of a vertical screen view, or may be the creation method of a transverse screen view; wherein, BView can represent the created and configured view, and the subsequent executable view plays the animation.
The view creation method is called to realize the creation and configuration of the view to be played currently, and sentences for creating the view in the creation method of the horizontal/vertical screen view and sentences for configuring the view can be the same. For example, when the current view to be played is a banner view, whether the creating method of the vertical view (uiv < dywbview protocol >) create bviewinview (uiv) view { } or the creating method of the horizontal view (uiv < dywbview protocol >) create bview (uiv) view { }, the current view to be played can be created by DYNobleWBView = [ DYNobleWBView loadFromXibRightStyle ] function, wherein [ DYNobleWBView loadFromXibRightStyle ] function is used for creating the current view to be played, and the current view to be played can return to nobleBView after the creation is completed; the created view to be currently played can also be configured through a [ nobleBView configViewMsg:self ] function, wherein self can characterize the parameters of the target view model;
note that the function of the function DYNobleWBView = [ DYNobleWBView loadFromXibRightStyle ] is to create a banner;
the detailed description is that DYNobleWBView is the view of the banner, loadFromXibRightStyle is the method of creating the view of the banner, no parameters are needed in this method, nobleBView is the view after the success of creating the banner, DYNobleWBView is the variable to create the completed view of the banner, and nobleBView is saved.
In some optional embodiments, if the display direction of the target view model is a horizontal screen, then calling a view creation method to create a view to be played currently, and configuring the view to be played currently according to parameters of the target view model includes: creating a current view to be played, and defining the current view to be played as a right display; and configuring the current view to be played according to the parameters of the target view model, and defining the length of the right side of the current view to be played.
For example, when the view to be played currently is a banner view, the step of creating and configuring the view to be played currently in the view { } by the creation method of the banner view (UIView < DYWBViewProtocol >) may be, for example: first, a view to be currently played can be created by a DYNobleWBView = [ DYNobleWBView loadFromXibRightStyle ] function; then, the current view to be played can be defined as the right display through a noblebview.isright=yes function; then, the view currently to be played can be configured by a [ nobleBView configViewMsg:self ] function; next, the length of the right side of the view to be currently played can be defined by a noblebview=view. Finally, the created and configured view nobleBView may be returned through return nobleBView.
Different views are created by calling corresponding view creation methods according to the screen display directions of the view models, and the created views are configured based on parameters of the view models, so that the creation of the different views based on unified view creation logic is realized, the unified creation logic of various views based on the view creation protocol is facilitated, and the view creation and queuing playing logic is simplified.
And S140, when the configured view is played, removing the current view model information from the preset array, and repeatedly obtaining the first view model information in the preset array.
After the view is configured and played, the current view model information msg in the preset array can be removed so as to acquire the next unreflected view model information through a first view display method showFirstMsg, so that queuing of the view can be realized based on queuing of the view model information.
In this embodiment, during queuing, queuing of a specific view is not concerned, but only the view model information is queued, and compared with conventional queuing of a constructed view, queuing of view model information can more conveniently implement queuing playing logic. In addition, view model information can be sequentially acquired, different views can be built and played by adopting unified logic, so that the universality of view building codes can be improved, and the convenience of code later maintenance can be improved.
According to the queuing playing method of the views, which is provided by the embodiment, the first view model information is acquired from the preset array through the first view display method, and whether the view model corresponding to the acquired view model information exists or not is judged; if yes, determining the screen display direction of the view model, and judging whether the view model complies with a view creation method corresponding to the screen display direction; if yes, a view creation method is called to create a view to be played currently, the view is configured according to parameters of a view model, and the configured view is played; and when the playing is finished, removing the view model information from the preset array, and repeatedly obtaining the first view model information in the preset array. Via circularly acquiring view model information in the array, different views are constructed and played by adopting unified logic, so that the universality of view construction codes can be improved, and the convenience of code later maintenance can be improved. And compared with the traditional queuing of constructing views, queuing playing logic can be more conveniently realized by queuing view model information.
Example two
Fig. 2 is a schematic structural diagram of a queuing playback apparatus according to a second embodiment of the present invention. The queuing and playing device provided by the embodiment of the invention can be suitable for the situation of queuing and playing the view, such as the situation of queuing and playing the banner view of the gift.
Referring to fig. 2, the queuing playback apparatus of the view includes:
the obtaining module 210 is configured to obtain, by using a first view display method, first view model information from a preset array, and determine whether a target view model corresponding to the obtained current view model information exists;
the judging module 220 is configured to determine a screen display direction of the target view model if the view model corresponding to the acquired view model information exists, and judge whether the target view model complies with a view creation method corresponding to the screen display direction;
the playing module 230 is configured to, if the view model complies with the view creation method corresponding to the screen display direction, call the view creation method to create a view to be played currently, configure the view to be played currently according to the parameters of the target view model, and play the configured view;
the removing module 240 is configured to remove the current view model information from the preset array when the configured view is played;
correspondingly, the obtaining module 210 is further configured to repeatedly obtain the first view model information in the preset array.
In some optional embodiments, if the display direction of the view model is a horizontal screen, the playing module is configured to create a view to be played currently, and define the view to be played currently as a right display; and configuring the current view to be played according to the parameters of the target view model, and defining the length of the right side of the current view to be played.
In some alternative embodiments, the queuing playback apparatus of a view further includes:
the protocol definition module is used for defining a view creation protocol before the first view model information is acquired from a preset array through a first view display method, and declaring a view creation method corresponding to each screen display direction through the view creation protocol.
In some further embodiments, the queuing playback apparatus of a view further includes:
the view customization module is used for defining a view customization interface after defining a view creation protocol and setting the view customization interface to comply with the view creation protocol; and customizing the graphic and text information of each view model by calling the view customization interface.
In some alternative embodiments, the queuing playback apparatus of a view further includes:
the array definition module is used for defining the preset array through an array definition statement before the first view model information is acquired from the preset array through a first view display method.
In some further embodiments, the queuing playback apparatus of a view further includes:
and the array adding module is used for calling a view information adding method after defining a preset array and adding the view model information of the view to be played into the preset array.
In some alternative embodiments, the view is a gift banner view.
The queuing and playing device for the views provided by the embodiment of the invention can execute the queuing and playing method for the views provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method. Technical details not described in detail can be seen in the queuing playback method of views provided in any embodiment of the present invention.
Example III
Fig. 3 is a schematic structural diagram of an electronic device according to a third embodiment of the present invention. Fig. 3 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing any of the embodiments of the present invention. The electronic device 12 shown in fig. 3 is merely an example and should not be construed as limiting the functionality and scope of use of embodiments of the present invention. Device 12 is typically an electronic device that undertakes in-line playback of the view.
As shown in fig. 3, the electronic device 12 is in the form of a general purpose computing device. Components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 connecting the different components, including the memory 28 and the processing unit 16.
Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor, and a local bus using any of a variety of bus architectures. By way of example, and not limitation, such architectures include industry standard architecture (Industry Standard Architecture, ISA) bus, micro channel architecture (Micro Channel Architecture, MCA) bus, enhanced ISA bus, video electronics standards association (Video Electronics Standards Association, VESA) local bus, and peripheral component interconnect (Peripheral Component Interconnect, PCI) bus.
Electronic device 12 typically includes a variety of computer-readable media. Such media can be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
Memory 28 may include computer device readable media in the form of volatile memory, such as random access memory (Random Access Memory, RAM) 30 and/or cache memory 32. The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer storage media. By way of example only, storage system 34 may be used to read from or write to non-removable, nonvolatile magnetic media (not shown in FIG. 3, commonly referred to as a "hard disk drive"). Although not shown in fig. 3, a disk drive for reading from and writing to a removable nonvolatile magnetic disk (e.g., a "floppy disk"), and an optical disk drive for reading from and writing to a removable nonvolatile optical disk (e.g., a Compact Disc-Read Only Memory (CD-ROM), digital versatile Disc (Digital Video Disc-Read Only Memory, DVD-ROM), or other optical media), may be provided. In such cases, each drive may be coupled to bus 18 through one or more data medium interfaces. Memory 28 may include at least one program product 40, with program product 40 having a set of program modules 42 configured to perform the functions of embodiments of the present invention. Program product 40 may be stored, for example, in memory 28, such program modules 42 include, but are not limited to, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment. Program modules 42 generally perform the functions and/or methods of the embodiments described herein.
The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, mouse, camera, etc., and display), with one or more devices that enable a user to interact with the electronic device 12, and/or with any device (e.g., network card, modem, etc.) that enables the electronic device 12 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., local area network (Local Area Network, LAN), wide area network Wide Area Network, WAN) and/or a public network, such as the internet) via the network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 over the bus 18. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 12, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, disk array (Redundant Arrays of Independent Disks, RAID) devices, tape drives, data backup storage devices, and the like.
The processor 16 executes various functional applications and data processing by running a program stored in the memory 28, for example, implementing a distribution method of a protocol provided by the above-described embodiment of the present invention, the method including:
acquiring first view model information from a preset array through a first view display method, and judging whether a target view model corresponding to the acquired current view model information exists or not; if yes, determining the screen display direction of the target view model, and judging whether the target view model complies with a view creation method corresponding to the screen display direction; if the target view model complies with the view creation method corresponding to the screen display direction, the view creation method is called to create a view to be played currently, the view to be played currently is configured according to the parameters of the target view model, and the configured view is played; and when the configured view is played, removing the current view model information from the preset array, and repeatedly acquiring the first view model information in the preset array.
Of course, those skilled in the art will understand that the processor may also implement the technical solution of the method for distributing the protocol provided in any embodiment of the present invention.
Example IV
The fourth embodiment of the present invention also provides a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a queuing playback method for views as provided by the embodiments of the present invention, the method including:
acquiring first view model information from a preset array through a first view display method, and judging whether a target view model corresponding to the acquired current view model information exists or not; if yes, determining the screen display direction of the target view model, and judging whether the target view model complies with a view creation method corresponding to the screen display direction; if the target view model complies with the view creation method corresponding to the screen display direction, the view creation method is called to create a view to be played currently, the view to be played currently is configured according to the parameters of the target view model, and the configured view is played; and when the configured view is played, removing the current view model information from the preset array, and repeatedly acquiring the first view model information in the preset array.
Of course, the computer readable storage medium provided by the embodiments of the present invention, on which the computer program stored is not limited to the above method operations, but may also perform the related operations in the queuing playback method of views provided by any of the embodiments of the present invention.
The computer storage media of embodiments of the invention may take the form of any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.