iOS_Development~News Channel Bar

Posted by simanta on Thu, 11 Jul 2019 19:43:06 +0200

NewsChannel (News Channel Bar)

Ready

News Channel Bar (NetEase News, Sina News, Sohu News, Today's Headlines, Cost-effective, Tencent Video, Youku and other similar channel bars)

Supports small red dot identification &lazy loading &caching &sorting &addition/deletion, etc.

No words, no results

Function Description

  1. Single channel small red dot identification: isShowRedPoint in JhtNewsChannelItemModel is BOOL value, you can add channel small red dot identification together when generating channel bar data Model, and set small red dot status in subsequent tuning interface as described above.

  2. Lazy loading: Pages are not fully loaded (not scrollview), click or slide to where to load the page, and you can set the number of caches yourself;

  3. Channel position is fixed: you can set one or more channel positions that are not changeable;

  4. Channel bar sorting: Custom sorting can be done in the sorting interface (with a jitter prompt);

  5. Channel addition and deletion: You can customize the channel addition and deletion in the sorting interface, including the sorting function;

  6. Note: The corresponding pages after sorting or adding or deleting can be found in the cache!

GO

How to use

1. Personalization

_a. JhtNewsChannelItemModel: Top Channel Model, which you can inherit to extend models that meet your needs;

_b. JhtChannelBarAndSlideViewConnectParamModel: Used to switch the relevant settings parameter model in the channel bar interface, including the tail plus button &&color and font size &&spacing and coordinates &&cached pages and other related settings;

_c. Attribute notMoveNameArray in JhtChannelBarAndSlideViewConnectParamModel sets channel position fixed, and toAddItemArray (for storing JhtNewsChannelItemModel) property sets channel array to be added;

_d. JhtNewsChannelItemEditParamModel: Used to sort the relevant settings parameter model in the interface, including text &text color &distance &background color class and other related settings.

_e. The structure of JhtChannelBarAndSlideViewConnectParamModel and JhtNewsChannelItemEditParamModel is shown below

  • Note: The required/optional distinction is marked inside the model

    _1. required: Required parameters, need to be passed

_2. optional: Personalized configuration parameters, with corresponding default values internally, have been labeled in detail

2. Create slider bars and slidable view s: relevant personalization settings are achieved by parameters in the passed Model

/** Create ChannelBarAndSliderView and Sort Delete Interface
 *  barAndSlideModel: Used to set sliderView and bar parameter model (with some property defaults)
 *  itemEditModel: Parameter settings for sorting interfaces (with some attribute defaults)
 *  withIsExistNavOrTab: Does it contain a NavigationBar || TabBar_enumeration
 *  channelArray: The added channel array stores the JhtNewsChannelItemModel (required parameter, and is the array that stores the JhtNewsChannelItemModel)
 *  baseViewController: In VC
 *  delegate: agent
 */
- (id)initSlideViewAndItemEditViewWithBarAndSlideModel:(JhtChannelBarAndSlideViewConnectParamModel *)barAndSlideModel withNewsChannelItemEditModel:(JhtNewsChannelItemEditParamModel *)itemEditModel withIsExistNavOrTab:(NT_IsExist)isExistType  withChanelArray:(NSMutableArray *)channelArray withBaseViewController:(id)baseViewController withDelegte:(id<JhtTotalSlideViewDelegate>)delegate;

3. JhtTotalSlideViewDelegate method

@protocol JhtTotalSlideViewDelegate <NSObject>
/** VC Total quantity */
- (NSInteger)numberOfTabsInJhtTotalSlideView:(JhtTotalSlideView *)sender;
/** VC under current index */
- (UIViewController *)JhtTotalSlideView:(JhtTotalSlideView *)sender controllerAt:(NSInteger)index;

/** Click on VC's index */
- (void)JhtTotalSlideView:(JhtTotalSlideView *)sender didSelectedAt:(NSInteger)index;

/** Operation after sorting
 *  modelArr: model array
 *  nameArray: Name array
 *  selectedIndex: Selected index
 */
- (void)JhtTotalSlideViewWithSortModelArr:(NSArray *)modelArr withNameArray:(NSArray *)nameArray withSelectIndex:(NSInteger)selectedIndex;

4. JhtChannelBarAndSlideViewConnect method

_a. Determine if the button at the end of the channel bar can be clicked

/** Determine if the bottom button of the channel bar can be clicked
 *  enable:yes Can be clicked 
 */
- (void)judgeChannelBarTailBtnIsEnableClick:(BOOL)enable;

_b. Hide or show small red dots

/** Hide or show small red dots
 *  hidden: yes hide
 *  index: topBar index of medium channel bar
 */
- (void)redPonitIsHidden:(BOOL)hidden withIndex:(NSInteger)index;

5. Modify SDK Mapping Resources

_If you need to replace the tangent resource in the SDK, you can simply replace the same name of the tangent in the JhtNewsChannelImages.bundle

  • Note: 1. To explain some user feedback cache doubts universally, the above mentioned cache refers to that after creating a VC under the channel and app is not restarted, after channel editing, the VC created before will be used internally first, if it does not exist, new VC will be recreated

    _2. If you want to make persistent storage after channel editing, you can do so in the following ways


_3. In demo you can see the related usage and configuration methods, which are detailed in demo

Finally, thank you for your long-standing support!

Github_Link Address

Topics: iOS Attribute SDK